From: yeom Date: Wed, 3 Aug 2011 02:09:32 +0000 (+0000) Subject: changes. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=e5bd2ec92933deaad1a28e92d58fdf5716a6c443;hp=03e4ef747b4dc3b230bc431ad476c773f09751d4 changes. --- diff --git a/Robust/src/Analysis/SSJava/FlowDownCheck.java b/Robust/src/Analysis/SSJava/FlowDownCheck.java index e2dc7384..d3870ccf 100644 --- a/Robust/src/Analysis/SSJava/FlowDownCheck.java +++ b/Robust/src/Analysis/SSJava/FlowDownCheck.java @@ -582,7 +582,7 @@ public class FlowDownCheck { CompositeLocation condLoc = checkLocationFromExpressionNode(md, nametable, ln.getCondition(), new CompositeLocation(), constraint, false); - addLocationType(ln.getCondition().getType(), (condLoc)); + // addLocationType(ln.getCondition().getType(), (condLoc)); constraint = generateNewConstraint(constraint, condLoc); checkLocationFromBlockNode(md, nametable, ln.getBody(), constraint); @@ -598,7 +598,7 @@ public class FlowDownCheck { CompositeLocation condLoc = checkLocationFromExpressionNode(md, bn.getVarTable(), ln.getCondition(), new CompositeLocation(), constraint, false); - addLocationType(ln.getCondition().getType(), condLoc); + // addLocationType(ln.getCondition().getType(), condLoc); constraint = generateNewConstraint(constraint, condLoc); @@ -640,7 +640,7 @@ public class FlowDownCheck { checkLocationFromExpressionNode(md, nametable, isn.getCondition(), new CompositeLocation(), constraint, false); - addLocationType(isn.getCondition().getType(), condLoc); + // addLocationType(isn.getCondition().getType(), condLoc); constraint = generateNewConstraint(constraint, condLoc); checkLocationFromBlockNode(md, nametable, isn.getTrueBlock(), constraint); @@ -790,15 +790,15 @@ public class FlowDownCheck { CompositeLocation condLoc = checkLocationFromExpressionNode(md, nametable, tn.getCond(), new CompositeLocation(), constraint, false); - addLocationType(tn.getCond().getType(), condLoc); + // addLocationType(tn.getCond().getType(), condLoc); CompositeLocation trueLoc = checkLocationFromExpressionNode(md, nametable, tn.getTrueExpr(), new CompositeLocation(), constraint, false); - addLocationType(tn.getTrueExpr().getType(), trueLoc); + // addLocationType(tn.getTrueExpr().getType(), trueLoc); CompositeLocation falseLoc = checkLocationFromExpressionNode(md, nametable, tn.getFalseExpr(), new CompositeLocation(), constraint, false); - addLocationType(tn.getFalseExpr().getType(), falseLoc); + // addLocationType(tn.getFalseExpr().getType(), falseLoc); // locations from true/false branches can be TOP when there are only literal // values @@ -869,7 +869,7 @@ public class FlowDownCheck { } private void checkCallerArgumentLocationConstraints(MethodDescriptor md, SymbolTable nametable, - MethodInvokeNode min, CompositeLocation baseLoc, CompositeLocation constraint) { + MethodInvokeNode min, CompositeLocation callerBaseLoc, CompositeLocation constraint) { // if parameter location consists of THIS and FIELD location, // caller should pass an argument that is comparable to the declared // parameter location @@ -901,16 +901,32 @@ public class FlowDownCheck { String errorMsg = generateErrorMessage(md.getClassDesc(), min); + System.out.println("checkCallerArgumentLocationConstraints=" + min.printNode(0)); + System.out.println("base location=" + callerBaseLoc); + for (int i = 0; i < calleeParamList.size(); i++) { CompositeLocation calleeParamLoc = calleeParamList.get(i); if (calleeParamLoc.get(0).equals(calleeThisLoc) && calleeParamLoc.getSize() > 1) { + // callee parameter location has field information - CompositeLocation argLocation = - translateCallerLocToCallee(md, calleeThisLoc, callerArgList.get(i),errorMsg); + CompositeLocation callerArgLoc = callerArgList.get(i); - if (!CompositeLattice.isGreaterThan(argLocation, calleeParamLoc, errorMsg)) { - throw new Error("Caller argument '" + min.getArg(i).printNode(0) - + "' should be higher than corresponding callee's parameter at " + errorMsg); + CompositeLocation paramLocation = + translateCalleeParamLocToCaller(md, calleeParamLoc, callerBaseLoc, errorMsg); + + Set inputGLBSet = new HashSet(); + if (constraint != null) { + inputGLBSet.add(callerArgLoc); + inputGLBSet.add(constraint); + callerArgLoc = + CompositeLattice.calculateGLB(inputGLBSet, + generateErrorMessage(md.getClassDesc(), min)); + } + + if (!CompositeLattice.isGreaterThan(callerArgLoc, paramLocation, errorMsg)) { + throw new Error("Caller argument '" + min.getArg(i).printNode(0) + " : " + callerArgLoc + + "' should be higher than corresponding callee's parameter : " + paramLocation + + " at " + errorMsg); } } @@ -918,32 +934,20 @@ public class FlowDownCheck { } - private CompositeLocation translateCallerLocToCallee(MethodDescriptor md, Location calleeThisLoc, - CompositeLocation callerArgLoc,String errorMsg) { + private CompositeLocation translateCalleeParamLocToCaller(MethodDescriptor md, + CompositeLocation calleeParamLoc, CompositeLocation callerBaseLocation, String errorMsg) { - ClassDescriptor calleeClassDesc = md.getClassDesc(); CompositeLocation translate = new CompositeLocation(); - int startIdx = 0; - for (int i = 0; i < callerArgLoc.getSize(); i++) { - if (callerArgLoc.get(i).getDescriptor().equals(calleeClassDesc)) { - startIdx = i; - } - } - - if (startIdx == 0) { - // caller arg location doesn't have field information - throw new Error("Caller argument location " + callerArgLoc - + " does not contain field information while callee has ordering constraints on field at "+errorMsg); + for (int i = 0; i < callerBaseLocation.getSize(); i++) { + translate.addLocation(callerBaseLocation.get(i)); } - translate.addLocation(calleeThisLoc); - - for (int i = startIdx + 1; i < callerArgLoc.getSize(); i++) { - translate.addLocation(callerArgLoc.get(i)); + for (int i = 1; i < calleeParamLoc.getSize(); i++) { + translate.addLocation(calleeParamLoc.get(i)); } - System.out.println("TRANSLATED=" + translate + " from callerArgLoc=" + callerArgLoc); + System.out.println("TRANSLATED=" + translate + " from calleeParamLoc=" + calleeParamLoc); return translate; } @@ -1290,6 +1294,8 @@ public class FlowDownCheck { } loc = checkLocationFromExpressionNode(md, nametable, left, loc, constraint, false); + System.out.println("### checkLocationFromFieldAccessNode=" + fan.printNode(0)); + System.out.println("### left=" + left.printNode(0)); if (!left.getType().isPrimitive()) { Location fieldLoc = getFieldLocation(fd); loc.addLocation(fieldLoc); @@ -1300,6 +1306,9 @@ public class FlowDownCheck { private Location getFieldLocation(FieldDescriptor fd) { + System.out.println("### getFieldLocation=" + fd); + System.out.println("### fd.getType().getExtension()=" + fd.getType().getExtension()); + Location fieldLoc = (Location) fd.getType().getExtension(); // handle the case that method annotation checking skips checking field @@ -1380,9 +1389,17 @@ public class FlowDownCheck { System.out.println("constraint=" + constraint); if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) { - throw new Error("Location " + destLocation - + " is not allowed to have the value flow that moves within the same location at " - + cd.getSourceFileName() + "::" + an.getNumLine()); + + if (srcLocation.equals(destLocation)) { + throw new Error("Location " + srcLocation + + " is not allowed to have the value flow that moves within the same location at '" + + an.printNode(0) + "' of " + cd.getSourceFileName() + "::" + an.getNumLine()); + } else { + throw new Error("The value flow from " + srcLocation + " to " + destLocation + + " does not respect location hierarchy on the assignment " + an.printNode(0) + + " at " + cd.getSourceFileName() + "::" + an.getNumLine()); + } + } } diff --git a/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java b/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java index 6a82e59a..aa47a961 100644 --- a/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java +++ b/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java @@ -37,7 +37,7 @@ // REVIEW: there is no range checking, so buffer underflow or overflow // can silently occur. -@LATTICE("BUF= 3; sfb--) { i = sfBandIndex[sfreq].s[sfb]; @@ -1447,8 +1457,8 @@ final class LayerIIIDecoder implements FrameDecoder { } // for (; sfb<8 ... } // for (j=0 ... } else { // if (gr_info.mixed_block_flag) - for (@LOC("THIS,LayerIIIDecoder.J") int j = 0; j < 3; j++) { - @LOC("THIS,LayerIIIDecoder.SH") int sfbcnt; + for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) { + @LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt; sfbcnt = -1; for (sfb = 12; sfb >= 0; sfb--) { temp = sfBandIndex[sfreq].s[sfb]; @@ -1643,7 +1653,7 @@ final class LayerIIIDecoder implements FrameDecoder { @LOC("THIS,LayerIIIDecoder.SI1") int bt; @LOC("SB") int sb18; // gr_info_s gr_info = (si.ch[ch].gr[gr]); //remove alias -// @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut; //remove alias + // @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut; //remove alias // float[][] prvblk; @@ -1653,7 +1663,7 @@ final class LayerIIIDecoder implements FrameDecoder { && (si.ch[ch].gr[gr].mixed_block_flag != 0) && (sb18 < 36)) ? 0 : si.ch[ch].gr[gr].block_type; -// tsOut = out_1d; + // tsOut = out_1d; // Modif E.B 02/22/99 for (@LOC("SB") int cc = 0; cc < 18; cc++) tsOutCopy[cc] = out_1d[cc + sb18]; @@ -1723,30 +1733,33 @@ final class LayerIIIDecoder implements FrameDecoder { /** * Fast INV_MDCT. */ - @LATTICE("OUT<6I,OUT 32767.0f){ - s=(short)32767; - }else if(sample < -32768.0f){ - s=(short)-32768; + @LATTICE("THIS,OUT 32767.0f) { + s = (short) 32767; + } else if (sample < -32768.0f) { + s = (short) -32768; } - + return s; -// return ((sample > 32767.0f) ? (short) 32767 : -// ((sample < -32768.0f) ? (short) -32768 : -// (short) sample)); } /** * Write the samples to the file or directly to the audio hardware. */ public abstract void write_buffer(@LOC("IN") int val); + public abstract void close(); /** diff --git a/Robust/src/Tests/ssJava/mp3decoder/Player.java b/Robust/src/Tests/ssJava/mp3decoder/Player.java index 647e4c94..f4774a20 100644 --- a/Robust/src/Tests/ssJava/mp3decoder/Player.java +++ b/Robust/src/Tests/ssJava/mp3decoder/Player.java @@ -32,7 +32,7 @@ // REVIEW: the audio device should not be opened until the // first MPEG audio frame has been decoded. -@LATTICE("B