- HashSet tovisit= new HashSet();
- HashSet visited= new HashSet();
-
- tovisit.add(fn);
- while(!tovisit.isEmpty()) {
- FlatNode fn1 = (FlatNode)tovisit.iterator().next();
- tovisit.remove(fn1);
- visited.add(fn1);
- for(int i = 0; i < fn1.numNext(); i++) {
- FlatNode nn=fn1.getNext(i);
- if (nn.kind()==13) {
- //***Debug Block***
- if (((FlatFlagActionNode)nn).getFFANType() == FlatFlagActionNode.PRE) {
- throw new Error("PRE FlagActions not supported");
- } else if (((FlatFlagActionNode)nn).getFFANType() == FlatFlagActionNode.NEWOBJECT) {
- //***Debug Block***
- System.out.println("NEWObject");
- //***Debug Block***
-
-
- TempDescriptor[] tdArray = ((FlatFlagActionNode)nn).readsTemps();
-
- //Under the safe assumption that all the temps in FFAN.NewObject node are of the same type(class)
- ClassDescriptor cd_new=tdArray[0].getType().getClassDesc();
-
- System.out.println("Class: "+cd_new.getSymbol());
-
- FlagState fstemp=new FlagState((FlagDescriptor[])flags.get(cd_new), cd_new);
-
- for(Iterator it_tfp=((FlatFlagActionNode)nn).getTempFlagPairs();it_tfp.hasNext();) {
- TempFlagPair tfp=(TempFlagPair)it_tfp.next();
- if (tfp.getFlag()==null) {
- System.out.println("test1");
- q_retval.addAll(createPossibleRuntimeStates(new TriggerState(cd_new,new FlagState((FlagDescriptor[])flags.get(cd_new), cd_new))));
- // ****debug block********
- System.out.println("/***********contents of q ret**********/");
- for (Iterator it_qret=q_retval.iterator();it_qret.hasNext();) {
- TriggerState ts_qret=(TriggerState)it_qret.next();
- FlagState fs_qret=ts_qret.getState();
-
- System.out.println("FS : "+fs_qret.toString((FlagDescriptor [])flags.get(ts_qret.getClassDescriptor())));
- }
- System.out.println("/*********************************/");
- // ****debug block********
- } else
- fstemp.put(tfp.getFlag(),new Boolean(((FlatFlagActionNode)nn).getFlagChange(tfp)));
-
-
- }
-
- //***Debug Block***
- System.out.println("test2");
- System.out.println("Newobj fsworking "+fsworking.toString((FlagDescriptor [])flags.get(cd_new)));
- System.out.println("Newobj fstemp "+fstemp.toString((FlagDescriptor [])flags.get(cd_new)));
-
- //***Debug Block***
-
- q_retval.offer(new TriggerState(cd_new,fstemp));
-
- //make this a function containsExterns()
- int extrns=((Integer)extern_flags.get(cd_new)).intValue();
-
- if ((extrns >0) && (extrns!=((FlagDescriptor[])flags.get(cd_new)).length))
- q_retval.addAll(createPossibleRuntimeStates(new TriggerState(cd_new,fstemp)));
-
- fstemp=null;
- // ****debug block********
- System.out.println("/***********contents of q ret 1**********/");
- for (Iterator it_qret=q_retval.iterator();it_qret.hasNext();) {
- TriggerState ts_qret=(TriggerState)it_qret.next();
- FlagState fs_qret=ts_qret.getState();
-
- System.out.println("FS : "+fs_qret.toString((FlagDescriptor [])flags.get(ts_qret.getClassDescriptor())));
- }
- System.out.println("/*********************************/");
- // ****debug block********
-
- }
- if (((FlatFlagActionNode)nn).getFFANType() == FlatFlagActionNode.TASKEXIT) {
- //***Debug Block***
- //
- System.out.println("TaskExit");
- //***Debug Block***
-
- FlagState fstemp=new FlagState(fsworking.getStateTable(), null); //WHAT CLASS IS THIS
-
- for(Iterator it_tfp=((FlatFlagActionNode)nn).getTempFlagPairs();it_tfp.hasNext();) {
- TempFlagPair tfp=(TempFlagPair)it_tfp.next();
- fstemp.put(tfp.getFlag(),new Boolean(((FlatFlagActionNode)nn).getFlagChange(tfp)));
- }
- //***Debug Block***
- System.out.println();
- System.out.println(fstemp.toString((FlagDescriptor [])flags.get(cd)));
- System.out.println();
- System.out.println("taskexit fsworking "+fsworking.toString((FlagDescriptor [])flags.get(cd)));
- System.out.println("taskexit fstemp "+fstemp.toString((FlagDescriptor [])flags.get(cd)));
-
- //***Debug Block***
- if (!edgeexists(Adj_List_temp,fsworking,fstemp,taskname)) {
- ((Vector)Adj_List_temp.get(fsworking)).add(new Edge(fstemp,taskname));
- }
- if (!wasFlagStateProcessed(Adj_List_temp,fstemp)) {
- q.offer(fstemp);
- }
- fstemp=null;
-
- }
- }
-
- if (!visited.contains(nn) && !tovisit.contains(nn)) {
- tovisit.add(nn);
- }