private static boolean checkSynchronizedCompleteness(Set<Statement> setNodes) { // check exit nodes for (Statement stat : setNodes) { if (stat.isMonitorEnter()) { List<StatEdge> lstSuccs = stat.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL); if (lstSuccs.size() != 1 || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) { return false; } if (!setNodes.contains(lstSuccs.get(0).getDestination())) { return false; } } } return true; }
public static Statement isHead(Statement head) { if (head.type == Statement.TYPE_BASICBLOCK && head.getLastBasicType() == Statement.LASTBASICTYPE_SWITCH) { List<Statement> lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { Statement post = lst.remove(0); for (Statement st : lst) { if (st.isMonitorEnter()) { return null; } } if (DecHelper.checkStatementExceptions(lst)) { return new SwitchStatement(head, post); } } } return null; }
public static Statement isHead(Statement head) { if (head.type == TYPE_BASICBLOCK && head.getLastBasicType() == LASTBASICTYPE_IF) { int regsize = head.getSuccessorEdges(StatEdge.TYPE_REGULAR).size(); Statement p = null; boolean ok = (regsize < 2); if (!ok) { List<Statement> lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { p = lst.remove(0); for (Statement st : lst) { if (st.isMonitorEnter()) { return null; } } ok = DecHelper.checkStatementExceptions(lst); } } if (ok) { return new IfStatement(head, regsize, p); } } return null; }
public static Statement isHead(Statement head) { if (head.getLastBasicType() != Statement.LASTBASICTYPE_GENERAL) { return null; } Set<Statement> setHandlers = DecHelper.getUniquePredExceptions(head); if (setHandlers.size() != 1) { return null; } for (StatEdge edge : head.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) { Statement exc = edge.getDestination(); if (edge.getExceptions() == null && exc.getLastBasicType() == LASTBASICTYPE_GENERAL && setHandlers.contains(exc)) { List<StatEdge> lstSuccs = exc.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (lstSuccs.isEmpty() || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) { if (head.isMonitorEnter() || exc.isMonitorEnter()) { return null; } if (DecHelper.checkStatementExceptions(Arrays.asList(head, exc))) { return new CatchAllStatement(head, exc); } } } } return null; }
public static Statement isHead2Block(Statement head) { if (head.getLastBasicType() != Statement.LASTBASICTYPE_GENERAL) { return null; } // at most one outgoing edge StatEdge edge = null; List<StatEdge> lstSuccs = head.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { edge = lstSuccs.get(0); } if (edge != null && edge.getType() == StatEdge.TYPE_REGULAR) { Statement stat = edge.getDestination(); if (stat != head && stat.getPredecessorEdges(StatEdge.TYPE_REGULAR).size() == 1 && !stat.isMonitorEnter()) { if (stat.getLastBasicType() == Statement.LASTBASICTYPE_GENERAL) { if (DecHelper.checkStatementExceptions(Arrays.asList(head, stat))) { return new SequenceStatement(head, stat); } } } } return null; }
public static Statement isHead(Statement head) { if (head.getLastBasicType() == LASTBASICTYPE_GENERAL && !head.isMonitorEnter()) { // at most one outgoing edge StatEdge edge = null; List<StatEdge> lstSuccs = head.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { edge = lstSuccs.get(0); } // regular loop if (edge != null && edge.getType() == StatEdge.TYPE_REGULAR && edge.getDestination() == head) { return new DoStatement(head); } // continues if (head.type != TYPE_DO && (edge == null || edge.getType() != StatEdge.TYPE_REGULAR) && head.getContinueSet().contains(head.getBasichead())) { return new DoStatement(head); } } return null; }
if (st.isMonitorEnter()) { return null;
if (current.isMonitorEnter()) {
private static boolean checkSynchronizedCompleteness(Statement head, HashSet<Statement> setNodes) { // check exit nodes for (Statement stat : setNodes) { if (stat.isMonitorEnter()) { List<StatEdge> lstSuccs = stat.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL); if (lstSuccs.size() != 1 || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) { return false; } if (!setNodes.contains(lstSuccs.get(0).getDestination())) { return false; } } } return true; }
public static Statement isHead(Statement head) { if (head.type == Statement.TYPE_BASICBLOCK && head.getLastBasicType() == Statement.LASTBASICTYPE_SWITCH) { List<Statement> lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { Statement post = lst.remove(0); for (Statement st : lst) { if (st.isMonitorEnter()) { return null; } } if (DecHelper.checkStatementExceptions(lst)) { return new SwitchStatement(head, post); } } } return null; }
public static Statement isHead(Statement head) { if (head.type == TYPE_BASICBLOCK && head.getLastBasicType() == LASTBASICTYPE_IF) { int regsize = head.getSuccessorEdges(StatEdge.TYPE_REGULAR).size(); Statement p = null; boolean ok = (regsize < 2); if (!ok) { List<Statement> lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { p = lst.remove(0); for (Statement st : lst) { if (st.isMonitorEnter()) { return null; } } ok = DecHelper.checkStatementExceptions(lst); } } if (ok) { return new IfStatement(head, regsize, p); } } return null; }
public static Statement isHead(Statement head) { if (head.getLastBasicType() != Statement.LASTBASICTYPE_GENERAL) { return null; } HashSet<Statement> setHandlers = DecHelper.getUniquePredExceptions(head); if (setHandlers.size() != 1) { return null; } for (StatEdge edge : head.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) { Statement exc = edge.getDestination(); if (edge.getExceptions() == null && setHandlers.contains(exc) && exc.getLastBasicType() == LASTBASICTYPE_GENERAL) { List<StatEdge> lstSuccs = exc.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (lstSuccs.isEmpty() || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) { if (head.isMonitorEnter() || exc.isMonitorEnter()) { return null; } if (DecHelper.checkStatementExceptions(Arrays.asList(head, exc))) { return new CatchAllStatement(head, exc); } } } } return null; }
public static Statement isHead2Block(Statement head) { if (head.getLastBasicType() != Statement.LASTBASICTYPE_GENERAL) { return null; } // at most one outgoing edge StatEdge edge = null; List<StatEdge> lstSuccs = head.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { edge = lstSuccs.get(0); } if (edge != null && edge.getType() == StatEdge.TYPE_REGULAR) { Statement stat = edge.getDestination(); if (stat != head && stat.getPredecessorEdges(StatEdge.TYPE_REGULAR).size() == 1 && !stat.isMonitorEnter()) { if (stat.getLastBasicType() == Statement.LASTBASICTYPE_GENERAL) { if (DecHelper.checkStatementExceptions(Arrays.asList(head, stat))) { return new SequenceStatement(head, stat); } } } } return null; }
public static Statement isHead(Statement head) { if (head.getLastBasicType() == LASTBASICTYPE_GENERAL && !head.isMonitorEnter()) { // at most one outgoing edge StatEdge edge = null; List<StatEdge> lstSuccs = head.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { edge = lstSuccs.get(0); } // regular loop if (edge != null && edge.getType() == StatEdge.TYPE_REGULAR && edge.getDestination() == head) { return new DoStatement(head); } // continues if (head.type != TYPE_DO && (edge == null || edge.getType() != StatEdge.TYPE_REGULAR) && head.getContinueSet().contains(head.getBasichead())) { return new DoStatement(head); } } return null; }
if (st.isMonitorEnter()) { return null;