From 95b03732aa9e38d44f206665d7cea341927a143c Mon Sep 17 00:00:00 2001 From: jzhou Date: Mon, 16 Nov 2009 02:30:42 +0000 Subject: [PATCH] bug fix --- .../src/Analysis/Scheduling/MCImplSynthesis.java | 15 +++++++++++++++ .../src/Analysis/Scheduling/SchedulingUtil.java | 13 +++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Robust/src/Analysis/Scheduling/MCImplSynthesis.java b/Robust/src/Analysis/Scheduling/MCImplSynthesis.java index 93252182..b2aa32b4 100644 --- a/Robust/src/Analysis/Scheduling/MCImplSynthesis.java +++ b/Robust/src/Analysis/Scheduling/MCImplSynthesis.java @@ -1006,6 +1006,11 @@ public class MCImplSynthesis { // first clone the whole graph Vector newscheduleGraph = cloneScheduleGraph(scheduleGraph, lgid); + + if(newscheduleGraph.size() == 0) { + System.err.println("empty schedule graph!"); + return optimizeschedulegraphs; + } // these nodes are root nodes Vector roots = new Vector(); @@ -1099,7 +1104,17 @@ public class MCImplSynthesis { } } cGen.clear(); + for(int i = 0; i < rootNodes.size(); i++) { + if(rootNodes.elementAt(i) != null) { + rootNodes.elementAt(i).clear(); + } + } rootNodes = null; + for(int i = 0; i < nodes2combine.size(); i++) { + if(nodes2combine.elementAt(i) != null) { + nodes2combine.elementAt(i).clear(); + } + } nodes2combine = null; for(int j = 0; j < newscheduleGraph.size(); j++) { ScheduleNode snode = newscheduleGraph.elementAt(j); diff --git a/Robust/src/Analysis/Scheduling/SchedulingUtil.java b/Robust/src/Analysis/Scheduling/SchedulingUtil.java index 3df8d890..10e8c7ff 100644 --- a/Robust/src/Analysis/Scheduling/SchedulingUtil.java +++ b/Robust/src/Analysis/Scheduling/SchedulingUtil.java @@ -177,11 +177,13 @@ public class SchedulingUtil { for(index = 0; index < sNodeVecs.size(); index++) { if(sNodeVecs.elementAt(index).elementAt(0).getCid() > tmpcid) { // find the place to insert - sNodeVecs.add(sNodeVecs.lastElement()); + sNodeVecs.insertElementAt(new Vector(), index); + /*sNodeVecs.add(sNodeVecs.lastElement()); for(int j = sNodeVecs.size() - 2; j > index; j--) { sNodeVecs.setElementAt(sNodeVecs.elementAt(j - 1), j); } - sNodeVecs.setElementAt(new Vector(), index); + sNodeVecs.setElementAt(new Vector(), index);*/ + break; } else if(sNodeVecs.elementAt(index).elementAt(0).getCid() == tmpcid) { break; } @@ -197,13 +199,16 @@ public class SchedulingUtil { if(sNodeVecs.elementAt(index) == null) { sNodeVecs.setElementAt(new Vector(), index); }*/ - sNodeVecs.elementAt(index).add(tmpn); + if(!sNodeVecs.elementAt(index).contains(tmpn)) { + sNodeVecs.elementAt(index).addElement(tmpn); + } } return sNodeVecs; } catch(Error e) { - System.err.println("Error in rangeScheduleNodes"); + System.err.println("Error in rangeScheduleNodes: " + scheduleNodes.size()); e.printStackTrace(); + //System.exit(-1); return null; } } -- 2.34.1