[runtime] Add a few mono mono_class_is_... accessors. (#3891)
[mono.git] / mono / mini / branch-opts.c
index 1a4ea53fe1f9ecfa48455f4961f6e1c8f1283639..c85bd5e0f1dd6558cabbeb11e7e483d968ebcf01 100644 (file)
@@ -6,11 +6,13 @@
  *
  * (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"
 #ifndef DISABLE_JIT
+
+#include "mini.h"
 
 /*
  * Returns true if @bb is a basic block which falls through the next block.
@@ -208,9 +210,11 @@ mono_replace_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst
 
                /* 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->real_offset = bb->real_offset;
+               }
 
                /* Split the original bb */
                if (ins->next)
@@ -248,7 +252,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 */
-               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]);