Permalink
Browse files

Few more safeguards, add per-analysis timeout of 2min

  • Loading branch information...
1 parent ddb60b6 commit dc1f793b9410106447076ee78dd6587a27fe65d3 @colder committed Jul 3, 2012
@@ -1196,6 +1196,10 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
aam.obj match {
case r: CFGTrees.Ref =>
map += targetCFG.mainThisRef -> r
+
+ case nr: CFGTrees.Null =>
+ // Ignore, most likely null == or null.eq
+
case _ =>
reporter.error("Unnexpected non-ref for the receiver!", aam.pos)
}
@@ -1284,6 +1288,8 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
if (innerG.category.isEmpty) {
env
+ } else if (innerG.category.isTop) {
+ innerG
} else {
//reporter.debug("in: "+fun.symbol+": Typemap for blinlining "+targetCFG.symbol.fullName+": "+typeMap)
//reporter.debug(" => "+nodes.map(n => n+"["+n.types+"]"))
@@ -1329,6 +1335,9 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
case r: CFGTrees.Ref =>
refMap += targetMainThisRef -> r
+ case nr: CFGTrees.Null =>
+ // Ignore, most likely null == or null.eq
+
case _ =>
reporter.error("Unnexpected non-ref for the receiver!", aam.pos)
}
@@ -1340,11 +1349,11 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
for ((iRef, oRef) <- refMap) {
val (newOG, outerNodes) = newOuterG.getNodes(oRef)
- val innerNodes = innerG.locState.get(iRef)
+ val innerNodes = innerG.locState(iRef)
newOuterG = newOG
- for (innerNode <- innerNodes.getOrElse(Set())) {
+ for (innerNode <- innerNodes) {
nodeMap ++= innerNode -> outerNodes
}
//for (innerNode <- innerNodes; outerNode <- outerNodes) {
@@ -1356,6 +1365,15 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
var (newOuterG2, newNodeMap) = mergeGraphsWithMap(newOuterG, innerG, nodeMap, aam.uniqueID, aam.pos, true)
+ if (!(innerG.locState contains targetRetval)) {
+ withDebugCounter { cnt =>
+ dumpPTE(env, "before-"+cnt+".dot")
+ dumpPTE(newOuterG2, "after-"+cnt+".dot")
+ dumpPTE(innerG, "inner-"+cnt+".dot")
+ dumpCFG(targetCFG, "cfg-"+cnt+".dot")
+ }
+ }
+
val mappedRet = innerG.locState(targetRetval) flatMap newNodeMap
if (mappedRet.isEmpty) {
@@ -1721,7 +1739,11 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
def globalTick() {
if (analysisStack.size > 0 && analysisStack.top.timeSpent() > settings.frameTimeout) {
- throw GiveUpException("Timeout reached")
+ throw GiveUpException("Frame Timeout reached")
+ }
+
+ if ((System.currentTimeMillis - globalTStart) > settings.globalTimeout) {
+ throw GiveUpException("Global Timeout reached")
}
}
@@ -2039,6 +2061,8 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
val cfgBefore = getPTCFGFromFun(fun)
+ globalTStart = System.currentTimeMillis
+
analyze(fun)
val cfgAfter = getPTCFGFromFun(fun)
@@ -2115,6 +2139,7 @@ trait PointToAnalysis extends PointToGraphsDefs with PointToEnvs with PointToLat
workList = workList.tail
val cfgBefore = getPTCFGFromFun(fun)
+ globalTStart = System.currentTimeMillis
analyze(fun)
val cfgAfter = getPTCFGFromFun(fun)
@@ -232,11 +232,15 @@ trait TypeHelpers extends TypeMaps with TypeSignatures { self: AnalysisComponent
// continue
}
}
- reporter.warn(List(
- "Failed to find:",
- uniqueFunctionName(methodSymbol)+" in ",
- from.baseTypeSeq.toList.mkString(", ")
- ))
+ settings.ifDebug {
+ if (from != NoType) {
+ reporter.warn(List(
+ "Failed to find:",
+ uniqueFunctionName(methodSymbol)+" in ",
+ from.baseTypeSeq.toList.mkString(", ")
+ ))
+ }
+ }
None
}
@@ -69,6 +69,8 @@ trait Context {
var analysisStackSet = Set[(Symbol, TypeSignature)]()
var recursiveMethods = Set[(Symbol, TypeSignature)]()
+ var globalTStart = 0l
+
class AnalysisContext(
val cfg: FunctionCFG,
val sig: TypeSignature,
@@ -78,8 +78,9 @@ trait Functions {
loaded.get(sym)
} catch {
case e: Throwable => // possible exceptions are MissingRequirementError, IOException and TypeError -> no better common supertype
- reporter.warn(List("Failed to load IClass for "+sym.fullName, e.getMessage))
- e.printStackTrace
+ //reporter.warn(List("Failed to load IClass for "+sym.fullName, e.getMessage))
+ reporter.warn("Failed to load IClass for "+sym.fullName)
+ //e.printStackTrace
None
}
}
@@ -18,7 +18,7 @@ class Settings {
var maxInlinableTargets = 10
var frameTimeout = 20000l
- var analysisTimeout = 120000l
+ var globalTimeout = 120000l
// Worklist Control
var wlSkipFirst = 0
@@ -38,7 +38,7 @@ class Settings {
def displayFixPoint = verbosity > Verbosity.Normal
def displayProgress = verbosity > Verbosity.Normal
- def immediateReport = debugMode
+ def immediateReport = true
def displayFullProgress = false
def getMatcher(s: Seq[String]) : (String => Boolean) = {

0 comments on commit dc1f793

Please sign in to comment.