diff options
author | Zoltan Varga <vargaz@gmail.com> | 2016-01-27 21:46:42 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2016-01-27 21:47:37 +0300 |
commit | 7ee763525e82215883a57fc473f4f635672c7638 (patch) | |
tree | 03a15779a4674b9a513cdb96fb4455e4300108cd | |
parent | 6a724e9a6ed3b8e497f35ea959daf83b4e125512 (diff) |
Revert "[runtime] Use explicit loop checking to remove depth limitation of sequence point search."
This reverts commit 23ce21ede0d26d2815c670a11e6d870506b91dd0.
Revert this as it is non-linear and can take a lot of time for complicated cfg structures.
-rw-r--r-- | mono/mini/seq-points.c | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/mono/mini/seq-points.c b/mono/mini/seq-points.c index 9afb2ed7993..ac22ca41f07 100644 --- a/mono/mini/seq-points.c +++ b/mono/mini/seq-points.c @@ -11,45 +11,29 @@ #include "seq-points.h" static void -insert_pred_seq_point (MonoBasicBlock *in_bb, MonoInst *ins, GSList **next) +collect_pred_seq_points (MonoBasicBlock *bb, MonoInst *ins, GSList **next, int depth) { + int i; + MonoBasicBlock *in_bb; GSList *l; - int src_index = in_bb->last_seq_point->backend.size; - int dst_index = ins->backend.size; - - /* bb->in_bb might contain duplicates */ - for (l = next [src_index]; l; l = l->next) - if (GPOINTER_TO_UINT (l->data) == dst_index) - break; - if (!l) - next [src_index] = g_slist_append (next [src_index], GUINT_TO_POINTER (dst_index)); -} -static void -collect_pred_seq_points (MonoBasicBlock *bb, MonoInst *ins, GSList **next, GHashTable *memoize) -{ - const gpointer MONO_SEQ_SEEN_LOOP = GINT_TO_POINTER(-1); + for (i = 0; i < bb->in_count; ++i) { + in_bb = bb->in_bb [i]; - for (int i = 0; i < bb->in_count; ++i) { - MonoBasicBlock *in_bb = bb->in_bb [i]; - gpointer result = g_hash_table_lookup (memoize, in_bb); + if (in_bb->last_seq_point) { + int src_index = in_bb->last_seq_point->backend.size; + int dst_index = ins->backend.size; - if (result == MONO_SEQ_SEEN_LOOP) { - // We've looped or handled this before, exit early. - // No last sequence points to find. - continue; - } else if (in_bb->last_seq_point) { - // if last seq point, insert into next - insert_pred_seq_point (in_bb, ins, next); + /* bb->in_bb might contain duplicates */ + for (l = next [src_index]; l; l = l->next) + if (GPOINTER_TO_UINT (l->data) == dst_index) + break; + if (!l) + next [src_index] = g_slist_append (next [src_index], GUINT_TO_POINTER (dst_index)); } else { - // Compute predecessors of in_bb - - // Insert/remove sentinel into the memoize table to detect loops containing in_bb - // This works to ensure that we only have a basic block on the stack once - // at any given time - g_hash_table_insert (memoize, in_bb, MONO_SEQ_SEEN_LOOP); - collect_pred_seq_points (in_bb, ins, next, memoize); - g_hash_table_remove (memoize, in_bb); + /* Have to look at its predecessors */ + if (depth < 5) + collect_pred_seq_points (in_bb, ins, next, depth + 1); } } } @@ -91,7 +75,6 @@ mono_save_seq_point_info (MonoCompile *cfg) * following it, this is needed to implement 'step over' in the debugger agent. */ next = g_new0 (GSList*, cfg->seq_points->len); - GHashTable *memoize = g_hash_table_new (NULL, NULL); for (bb = cfg->bb_entry; bb; bb = bb->next_bb) { bb_seq_points = g_slist_reverse (bb->seq_points); last = NULL; @@ -109,7 +92,7 @@ mono_save_seq_point_info (MonoCompile *cfg) next [last->backend.size] = g_slist_append (next [last->backend.size], GUINT_TO_POINTER (ins->backend.size)); } else { /* Link with the last bb in the previous bblocks */ - collect_pred_seq_points (bb, ins, next, memoize); + collect_pred_seq_points (bb, ins, next, 0); } last = ins; @@ -140,7 +123,6 @@ mono_save_seq_point_info (MonoCompile *cfg) } } } - g_hash_table_destroy (memoize); if (cfg->verbose_level > 2) { printf ("\nSEQ POINT MAP: \n"); |