On splitting a bb, the successors of the new bb were still pointing at
the original bb. This caused the CFG to be inconsistent and subsequently
also mimic stack spill/restore to do the wrong thing.

This fixes the java.security.ProtectionDomain crash.

Codebugged-by: Arthur Huillet <arthur.huil...@free.fr>
Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 jit/basic-block.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/jit/basic-block.c b/jit/basic-block.c
index c0ac458..6e8759b 100644
--- a/jit/basic-block.c
+++ b/jit/basic-block.c
@@ -117,6 +117,19 @@ struct basic_block *bb_split(struct basic_block *orig_bb, 
unsigned long offset)
        new_bb->predecessors = NULL;
        new_bb->nr_predecessors = 0;
 
+       /* The original successors' predecessors must be updated to point to
+        * the new basic block. */
+       for (unsigned int i = 0, n = new_bb->nr_successors; i < n; ++i) {
+               struct basic_block *successor = new_bb->successors[i];
+
+               for (unsigned int j = 0, m = successor->nr_predecessors;
+                       j < m; ++j)
+               {
+                       if (successor->predecessors[j] == orig_bb)
+                               successor->predecessors[j] = new_bb;
+               }
+       }
+
        if (orig_bb->has_branch) {
                orig_bb->has_branch = false;
                new_bb->has_branch = true;
-- 
1.6.0.4


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to