[jit] Fix the linking of bblocks in mono_replace_ins () by avoiding iterating over...
authorZoltan Varga <vargaz@gmail.com>
Mon, 18 Apr 2016 17:26:55 +0000 (13:26 -0400)
committerZoltan Varga <vargaz@gmail.com>
Mon, 18 Apr 2016 17:27:00 +0000 (13:27 -0400)
mono/mini/branch-opts.c

index 7b2bedd56470c901f27cba63a015a2309c382c16..ca8289b81c8313619b3f5c3e5fec193c4a503298 100644 (file)
@@ -249,7 +249,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]);