projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[runtime] Global debug option for using fallback tls
[mono.git]
/
mono
/
mini
/
branch-opts.c
diff --git
a/mono/mini/branch-opts.c
b/mono/mini/branch-opts.c
index a6d4915ee3697032916385ff1f2e81d0e5f6ba34..1602b03d59aae4ef6d211d82ce75bf61f80b17b6 100644
(file)
--- a/
mono/mini/branch-opts.c
+++ b/
mono/mini/branch-opts.c
@@
-6,11
+6,14
@@
*
* (C) 2005 Ximian, Inc. http://www.ximian.com
* Copyright 2011 Xamarin Inc. http://www.xamarin.com
*
* (C) 2005 Ximian, Inc. http://www.ximian.com
* Copyright 2011 Xamarin Inc. http://www.xamarin.com
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
*/
- #include "mini.h"
+#include "config.h"
+#include <mono/utils/mono-compiler.h>
#ifndef DISABLE_JIT
#ifndef DISABLE_JIT
-
+
+#include "mini.h"
/*
* Returns true if @bb is a basic block which falls through the next block.
/*
* Returns true if @bb is a basic block which falls through the next block.
@@
-44,7
+47,7
@@
mono_branch_optimize_exception_target (MonoCompile *cfg, MonoBasicBlock *bb, con
if (bb->region == -1 || !MONO_BBLOCK_IS_IN_REGION (bb, MONO_REGION_TRY))
return NULL;
if (bb->region == -1 || !MONO_BBLOCK_IS_IN_REGION (bb, MONO_REGION_TRY))
return NULL;
- exclass = mono_class_from_name (mono_get_corlib (), "System", exname);
+ exclass = mono_class_
load_
from_name (mono_get_corlib (), "System", exname);
/* search for the handler */
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
/* search for the handler */
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
@@
-85,7
+88,7
@@
mono_branch_optimize_exception_target (MonoCompile *cfg, MonoBasicBlock *bb, con
MONO_INST_NEW (cfg, jump, OP_BR);
/* Allocate memory for our branch target */
MONO_INST_NEW (cfg, jump, OP_BR);
/* Allocate memory for our branch target */
- jump->inst_i1 = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoInst));
+ jump->inst_i1 =
(MonoInst *)
mono_mempool_alloc0 (cfg->mempool, sizeof (MonoInst));
jump->inst_true_bb = targetbb;
if (cfg->verbose_level > 2)
jump->inst_true_bb = targetbb;
if (cfg->verbose_level > 2)
@@
-208,9
+211,11
@@
mono_replace_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst
/* Multiple BBs */
/* Multiple BBs */
- /* Set region */
- for (tmp = first_bb; tmp; tmp = tmp->next_bb)
+ /* Set region
/real_offset
*/
+ for (tmp = first_bb; tmp; tmp = tmp->next_bb)
{
tmp->region = bb->region;
tmp->region = bb->region;
+ tmp->real_offset = bb->real_offset;
+ }
/* Split the original bb */
if (ins->next)
/* Split the original bb */
if (ins->next)
@@
-248,7
+253,8
@@
mono_replace_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst
bb->has_array_access |= first_bb->has_array_access;
/* Delete the links between the original bb and its successors */
bb->has_array_access |= first_bb->has_array_access;
/* Delete the links between the original bb and its successors */
- tmp_bblocks = bb->out_bb;
+ tmp_bblocks = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoBasicBlock*) * bb->out_count);
+ memcpy (tmp_bblocks, bb->out_bb, sizeof (MonoBasicBlock*) * bb->out_count);
count = bb->out_count;
for (i = 0; i < count; ++i)
mono_unlink_bblock (cfg, bb, tmp_bblocks [i]);
count = bb->out_count;
for (i = 0; i < count; ++i)
mono_unlink_bblock (cfg, bb, tmp_bblocks [i]);
@@
-851,7
+857,7
@@
replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBl
ins->inst_false_bb = repl;
} else if (MONO_IS_JUMP_TABLE (ins)) {
int i;
ins->inst_false_bb = repl;
} else if (MONO_IS_JUMP_TABLE (ins)) {
int i;
- MonoJumpInfoBBTable *table = MONO_JUMP_TABLE_FROM_INS (ins);
+ MonoJumpInfoBBTable *table =
(MonoJumpInfoBBTable *)
MONO_JUMP_TABLE_FROM_INS (ins);
for (i = 0; i < table->table_size; i++ ) {
if (table->table [i] == orig)
table->table [i] = repl;
for (i = 0; i < table->table_size; i++ ) {
if (table->table [i] == orig)
table->table [i] = repl;
@@
-995,7
+1001,7
@@
mono_merge_basic_blocks (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *b
for (inst = bb->code; inst != NULL; inst = inst->next) {
if (MONO_IS_JUMP_TABLE (inst)) {
int i;
for (inst = bb->code; inst != NULL; inst = inst->next) {
if (MONO_IS_JUMP_TABLE (inst)) {
int i;
- MonoJumpInfoBBTable *table = MONO_JUMP_TABLE_FROM_INS (inst);
+ MonoJumpInfoBBTable *table =
(MonoJumpInfoBBTable *)
MONO_JUMP_TABLE_FROM_INS (inst);
for (i = 0; i < table->table_size; i++ ) {
/* Might be already NULL from a previous merge */
if (table->table [i])
for (i = 0; i < table->table_size; i++ ) {
/* Might be already NULL from a previous merge */
if (table->table [i])
@@
-1137,7
+1143,7
@@
mono_remove_critical_edges (MonoCompile *cfg)
* overwrite the sreg1 of the ins.
*/
if ((in_bb->out_count > 1) || (in_bb->out_count == 1 && in_bb->last_ins && in_bb->last_ins->opcode == OP_BR_REG)) {
* overwrite the sreg1 of the ins.
*/
if ((in_bb->out_count > 1) || (in_bb->out_count == 1 && in_bb->last_ins && in_bb->last_ins->opcode == OP_BR_REG)) {
- MonoBasicBlock *new_bb = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
+ MonoBasicBlock *new_bb =
(MonoBasicBlock *)
mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
new_bb->block_num = cfg->num_bblocks++;
// new_bb->real_offset = bb->real_offset;
new_bb->region = bb->region;
new_bb->block_num = cfg->num_bblocks++;
// new_bb->real_offset = bb->real_offset;
new_bb->region = bb->region;
@@
-1161,7
+1167,7
@@
mono_remove_critical_edges (MonoCompile *cfg)
/* We cannot add any inst to the entry BB, so we must */
/* put a new BB in the middle to hold the OP_BR */
MonoInst *jump;
/* We cannot add any inst to the entry BB, so we must */
/* put a new BB in the middle to hold the OP_BR */
MonoInst *jump;
- MonoBasicBlock *new_bb_after_entry = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
+ MonoBasicBlock *new_bb_after_entry =
(MonoBasicBlock *)
mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
new_bb_after_entry->block_num = cfg->num_bblocks++;
// new_bb_after_entry->real_offset = bb->real_offset;
new_bb_after_entry->region = bb->region;
new_bb_after_entry->block_num = cfg->num_bblocks++;
// new_bb_after_entry->real_offset = bb->real_offset;
new_bb_after_entry->region = bb->region;
@@
-1190,10
+1196,10
@@
mono_remove_critical_edges (MonoCompile *cfg)
previous_bb = new_bb;
/* Setup in_bb and out_bb */
previous_bb = new_bb;
/* Setup in_bb and out_bb */
- new_bb->in_bb = mono_mempool_alloc ((cfg)->mempool, sizeof (MonoBasicBlock*));
+ new_bb->in_bb =
(MonoBasicBlock **)
mono_mempool_alloc ((cfg)->mempool, sizeof (MonoBasicBlock*));
new_bb->in_bb [0] = in_bb;
new_bb->in_count = 1;
new_bb->in_bb [0] = in_bb;
new_bb->in_count = 1;
- new_bb->out_bb = mono_mempool_alloc ((cfg)->mempool, sizeof (MonoBasicBlock*));
+ new_bb->out_bb =
(MonoBasicBlock **)
mono_mempool_alloc ((cfg)->mempool, sizeof (MonoBasicBlock*));
new_bb->out_bb [0] = bb;
new_bb->out_count = 1;
new_bb->out_bb [0] = bb;
new_bb->out_count = 1;
@@
-1474,4
+1480,8
@@
mono_optimize_branches (MonoCompile *cfg)
} while (changed && (niterations > 0));
}
} while (changed && (niterations > 0));
}
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (branch_opts);
+
+#endif /* !DISABLE_JIT */