Index: build/make/components/vm/jitrino.xml =================================================================== --- build/make/components/vm/jitrino.xml (revision 465468) +++ build/make/components/vm/jitrino.xml (working copy) @@ -63,6 +63,13 @@ + + + + + + + Index: vm/vmcore/include/version_svn_tag.h =================================================================== --- vm/vmcore/include/version_svn_tag.h (revision 465468) +++ vm/vmcore/include/version_svn_tag.h (working copy) @@ -18,6 +18,6 @@ #ifndef _VERSION_SVN_TAG_ #define _VERSION_SVN_TAG_ -#define VERSION_SVN_TAG "464471" +#define VERSION_SVN_TAG "465468" #endif // _VERSION_SVN_TAG_ Index: vm/jitrino/src/optimizer/FlowGraph.h =================================================================== --- vm/jitrino/src/optimizer/FlowGraph.h (revision 465468) +++ vm/jitrino/src/optimizer/FlowGraph.h (working copy) @@ -57,7 +57,7 @@ // If !isTaken, then the false edge is converted, and the true edge // is deleted. In either case, the branch instruction br is removed // from block. - static void foldBranch(ControlFlowGraph& fg, Node* block, BranchInst* br, bool isTaken); + static void foldBranch(ControlFlowGraph& fg, BranchInst* br, bool isTaken); static void foldSwitch(ControlFlowGraph& fg, Node* block, SwitchInst* sw, uint32 target); Index: vm/jitrino/src/optimizer/simplifier.cpp =================================================================== --- vm/jitrino/src/optimizer/simplifier.cpp (revision 465468) +++ vm/jitrino/src/optimizer/simplifier.cpp (working copy) @@ -3821,7 +3821,7 @@ void SimplifierWithInstFactory::foldBranch(BranchInst* br, bool isTaken) { - FlowGraph::foldBranch(flowGraph, currentCfgNode,br,isTaken); + FlowGraph::foldBranch(flowGraph, br,isTaken); } void Index: vm/jitrino/src/optimizer/tailduplicator.cpp =================================================================== --- vm/jitrino/src/optimizer/tailduplicator.cpp (revision 465468) +++ vm/jitrino/src/optimizer/tailduplicator.cpp (working copy) @@ -116,8 +116,8 @@ ControlFlowGraph& fg = _irm.getFlowGraph(); Node* copy = FlowGraph::tailDuplicate(_irm, t2, tail, defUses); - FlowGraph::foldBranch(fg, copy, ((Inst*)copy->getLastInst())->asBranchInst(), true); - FlowGraph::foldBranch(fg, tail, ((Inst*)tail->getLastInst())->asBranchInst(), false); + FlowGraph::foldBranch(fg, ((Inst*)copy->getLastInst())->asBranchInst(), true); + FlowGraph::foldBranch(fg, ((Inst*)tail->getLastInst())->asBranchInst(), false); } void Index: vm/jitrino/src/optimizer/FlowGraph.cpp =================================================================== --- vm/jitrino/src/optimizer/FlowGraph.cpp (revision 465468) +++ vm/jitrino/src/optimizer/FlowGraph.cpp (working copy) @@ -1,11 +1,10 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable. * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -66,10 +65,11 @@ void -FlowGraph::foldBranch(ControlFlowGraph& fg, Node* block, BranchInst* br, bool isTaken) +FlowGraph::foldBranch(ControlFlowGraph& fg, BranchInst* br, bool isTaken) { - assert(br == block->getLastInst()); - assert(block->getOutDegree() == 2); + Node* block = br->getNode(); + assert(block->getOutDegree() == 2); + fg.removeEdge(block->getOutEdge(isTaken ? Edge::Kind_False : Edge::Kind_True)); br->unlink(); } Index: vm/jitrino/src/optimizer/hashvaluenumberer.cpp =================================================================== --- vm/jitrino/src/optimizer/hashvaluenumberer.cpp (revision 465468) +++ vm/jitrino/src/optimizer/hashvaluenumberer.cpp (working copy) @@ -2484,9 +2484,9 @@ BranchInst *branchi = inst->asBranchInst(); if (branchi) { if (optimizedOpcode == Op_TauUnsafe) { - FlowGraph::foldBranch(fg, block, branchi, false); // not taken + FlowGraph::foldBranch(fg, branchi, false); // not taken } else { - FlowGraph::foldBranch(fg, block, branchi, true); // taken + FlowGraph::foldBranch(fg, branchi, true); // taken } return; } Index: vm/jitrino/src/shared/ControlFlowGraph.cpp =================================================================== --- vm/jitrino/src/shared/ControlFlowGraph.cpp (revision 467584) +++ vm/jitrino/src/shared/ControlFlowGraph.cpp (working copy) @@ -223,13 +223,14 @@ void ControlFlowGraph::removeNode(Nodes::iterator pos, bool erase) { Node* node = *pos; - assert(node!=entryNode); + if (node == entryNode) { + entryNode=NULL; + } if (node == returnNode) { returnNode = NULL; } else if(node == unwindNode) { unwindNode = NULL; } else if (node == exitNode) { - assert(0); exitNode = NULL; }