projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[sgen] When out of memory, finish concurrent with scanning whole nursery. Fixes...
[mono.git]
/
mono
/
mini
/
branch-opts.c
diff --git
a/mono/mini/branch-opts.c
b/mono/mini/branch-opts.c
index 141b90a2be2a7f30e677b621bb1f6eef46728708..2be95e736424d43c562b3e52612273e3372788f1 100644
(file)
--- a/
mono/mini/branch-opts.c
+++ b/
mono/mini/branch-opts.c
@@
-5,6
+5,7
@@
* Patrik Torstensson (Patrik.Torstesson at gmail.com)
*
* (C) 2005 Ximian, Inc. http://www.ximian.com
* Patrik Torstensson (Patrik.Torstesson at gmail.com)
*
* (C) 2005 Ximian, Inc. http://www.ximian.com
+ * Copyright 2011 Xamarin Inc. http://www.xamarin.com
*/
#include "mini.h"
*/
#include "mini.h"
@@
-134,7
+135,7
@@
static const int long_cmov_opcodes [] = {
OP_CMOV_LGT_UN
};
OP_CMOV_LGT_UN
};
-static int
+static
G_GNUC_UNUSED
int
br_to_br_un (int opcode)
{
switch (opcode) {
br_to_br_un (int opcode)
{
switch (opcode) {
@@
-970,6
+971,12
@@
mono_merge_basic_blocks (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *b
bb->has_array_access |= bbn->has_array_access;
bb->extended |= bbn->extended;
bb->has_array_access |= bbn->has_array_access;
bb->extended |= bbn->extended;
+ /* Compute prev_bb if possible to avoid the linear search below */
+ prev_bb = NULL;
+ for (i = 0; i < bbn->in_count; ++i)
+ if (bbn->in_bb [0]->next_bb == bbn)
+ prev_bb = bbn->in_bb [0];
+
mono_unlink_bblock (cfg, bb, bbn);
for (i = 0; i < bbn->out_count; ++i)
mono_link_bblock (cfg, bb, bbn->out_bb [i]);
mono_unlink_bblock (cfg, bb, bbn);
for (i = 0; i < bbn->out_count; ++i)
mono_link_bblock (cfg, bb, bbn->out_bb [i]);
@@
-1022,8
+1029,10
@@
mono_merge_basic_blocks (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *b
bb->last_ins = bbn->last_ins;
}
bb->last_ins = bbn->last_ins;
}
- for (prev_bb = cfg->bb_entry; prev_bb && prev_bb->next_bb != bbn; prev_bb = prev_bb->next_bb)
- ;
+ if (!prev_bb) {
+ for (prev_bb = cfg->bb_entry; prev_bb && prev_bb->next_bb != bbn; prev_bb = prev_bb->next_bb)
+ ;
+ }
if (prev_bb) {
prev_bb->next_bb = bbn->next_bb;
} else {
if (prev_bb) {
prev_bb->next_bb = bbn->next_bb;
} else {
@@
-1290,7
+1299,7
@@
mono_optimize_branches (MonoCompile *cfg)
/* branches to the following block can be removed */
if (bb->last_ins && bb->last_ins->opcode == OP_BR && !bbn->out_of_line) {
/* branches to the following block can be removed */
if (bb->last_ins && bb->last_ins->opcode == OP_BR && !bbn->out_of_line) {
-
bb->last_ins->opcode = OP_NOP
;
+
NULLIFY_INS (bb->last_ins)
;
changed = TRUE;
if (cfg->verbose_level > 2)
g_print ("br removal triggered %d -> %d\n", bb->block_num, bbn->block_num);
changed = TRUE;
if (cfg->verbose_level > 2)
g_print ("br removal triggered %d -> %d\n", bb->block_num, bbn->block_num);