soot.toolkits.graph.CompleteUnitGraph Maven / Gradle / Ivy
Show all versions of robovm-soot Show documentation
/* Soot - a J*va Optimization Framework
* Copyright (C) 1999 Patrice Pominville, Raja Vallee-Rai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the Sable Research Group and others 1997-2004.
* See the 'credits' file distributed with Soot for the complete list of
* contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
*/
package soot.toolkits.graph;
import soot.Body;
import soot.toolkits.graph.ExceptionalUnitGraph;
import soot.toolkits.exceptions.PedanticThrowAnalysis;
/**
* Represents a CFG for a {@link Body} instance where the nodes
* are {@link soot.Unit} instances, and where control flow
* associated with exceptions is taken into account. In a
* CompleteUnitGraph
, every Unit
covered by
* a {@link soot.Trap} is considered to have the potential to
* throw an exception caught by the Trap
, so there are
* edges to the Trap
's handler from every trapped
* Unit
, as well as from all the predecessors of the
* trapped Unit
s.
*
*
This implementation of CompleteUnitGraph
is
* included for backwards compatibility (new code should use {@link
* ExceptionalUnitGraph}), but the graphs it produces are not
* necessarily identical to the graphs produced by the implementation
* of CompleteUnitGraph
provided by versions of Soot up
* to and including release 2.1.0. The known differences include:
*
*
*
* - If a
Body
includes Unit
s which
* branch into the middle of the region protected by a
* Trap
this implementation of
* CompleteUnitGraph
will include edges from those
* branching Unit
s to the Trap
's handler
* (since the branches are predecessors of an instruction which may
* throw an exception caught by the Trap
). The 2.1.0
* implementation of CompleteUnitGraph
mistakenly
* omitted these edges.
*
* - If the initial
Unit
in the Body
* might throw an exception caught by a Trap
within the
* body, this implementation will include the initial handler
* Unit
in the list returned by
* getHeads()
(since the handler unit might be the first
* Unit in the method to execute to completion). The 2.1.0
* implementation of CompleteUnitGraph
mistakenly
* omitted the handler from the set of heads.
*
*
*/
public class CompleteUnitGraph extends ExceptionalUnitGraph
{
public CompleteUnitGraph(Body b) {
super(b, PedanticThrowAnalysis.v(), false);
}
}