diff --git a/core/src/test/scala/com/phaller/rasync/test/opal/PurityAnalysis.scala b/core/src/test/scala/com/phaller/rasync/test/opal/PurityAnalysis.scala index a1b0753..fcb90e0 100644 --- a/core/src/test/scala/com/phaller/rasync/test/opal/PurityAnalysis.scala +++ b/core/src/test/scala/com/phaller/rasync/test/opal/PurityAnalysis.scala @@ -81,9 +81,13 @@ object PurityStrategy extends SchedulingStrategy[Purity, Null] { object PurityAnalysis extends ProjectAnalysisApplication { + var parl: Int = 10 + override def main(args: Array[String]): Unit = { val lib = Project(new java.io.File(args(args.length - 1))) //JRELibraryFolder.getAbsolutePath)) + parl = Integer.parseInt(args(args.length - 2)) + println("Heap size: " + Runtime.getRuntime().maxMemory()) schedulingStrategy = new DefaultScheduling[Purity, Null] @@ -103,7 +107,7 @@ object PurityAnalysis extends ProjectAnalysisApplication { new SourcesWithManySourcesFirst[Purity, Null], new SourcesWithManySourcesLast[Purity, Null], PurityStrategy) - i ← (0 until 5) + i ← (0 until 7) } { val p = lib.recreate() schedulingStrategy = scheduling @@ -123,7 +127,7 @@ object PurityAnalysis extends ProjectAnalysisApplication { val startTime = System.currentTimeMillis // Used for measuring execution time // 1. Initialization of key data structures (one cell(completer) per method) - implicit val pool: HandlerPool[Purity, Null] = new HandlerPool(key = PurityKey, parallelism = 10, schedulingStrategy = schedulingStrategy) + implicit val pool: HandlerPool[Purity, Null] = new HandlerPool(key = PurityKey, parallelism = parl, schedulingStrategy = schedulingStrategy) var methodToCell = Map.empty[Method, Cell[Purity, Null]] for { classFile <- project.allProjectClassFiles diff --git a/core/src/test/scala/com/phaller/rasync/test/opal/ifds/AbstractIFDSAnalysis.scala b/core/src/test/scala/com/phaller/rasync/test/opal/ifds/AbstractIFDSAnalysis.scala index a33dace..01ca506 100644 --- a/core/src/test/scala/com/phaller/rasync/test/opal/ifds/AbstractIFDSAnalysis.scala +++ b/core/src/test/scala/com/phaller/rasync/test/opal/ifds/AbstractIFDSAnalysis.scala @@ -3,7 +3,7 @@ package com.phaller.rasync.test.opal.ifds import java.util.concurrent.ConcurrentHashMap -import com.phaller.rasync.lattice.{ Key, Lattice } +import com.phaller.rasync.lattice.{ Key, PartialOrderingWithBottom, Updater } import com.phaller.rasync.cell._ import com.phaller.rasync.pool.{ HandlerPool, SchedulingStrategy } import scala.collection.{ Set ⇒ SomeSet } @@ -82,18 +82,17 @@ abstract class AbstractIFDSAnalysis[DataFlowFact <: AbstractIFDSFact](parallelis object TheKey extends Key[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)] { override def resolve(cells: Iterable[Cell[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)]]): Iterable[(Cell[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)], IFDSProperty[DataFlowFact])] = { val p = createProperty(Map.empty) - cells.map((_, p)) + cells.map(c ⇒ (c, c.getResult())) } override def fallback(cells: Iterable[Cell[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)]]): Iterable[(Cell[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)], IFDSProperty[DataFlowFact])] = { val p = createProperty(Map.empty) - cells.map((_, p)) + cells.map(c ⇒ (c, c.getResult())) } } - implicit object TheLattice extends Lattice[IFDSProperty[DataFlowFact]] { - override def join(v1: IFDSProperty[DataFlowFact], v2: IFDSProperty[DataFlowFact]): IFDSProperty[DataFlowFact] = - createProperty(mergeMaps(v1.flows, v2.flows)) + implicit object TheLattice extends PartialOrderingWithBottom[IFDSProperty[DataFlowFact]] { + override def lteq(v1: IFDSProperty[DataFlowFact], v2: IFDSProperty[DataFlowFact]): Boolean = v1.flows.size <= v2.flows.size override val bottom: IFDSProperty[DataFlowFact] = createProperty(Map.empty) } @@ -171,7 +170,7 @@ abstract class AbstractIFDSAnalysis[DataFlowFact <: AbstractIFDSFact](parallelis /** Map (method, fact) pairs to cells. A new cell is created, if it does not exist yet. See also mf() for the reverse direction. */ private def cell(source: (DeclaredMethod, DataFlowFact)): Cell[IFDSProperty[DataFlowFact], (DeclaredMethod, DataFlowFact)] = { // Can performance be improved if we first check, if mfToCell.isDefinedAt(source) first? - val c = pool.mkSequentialCell(c ⇒ performAnalysis(source), source) + val c = pool.mkSequentialCell(c ⇒ performAnalysis(source), source)(Updater.partialOrderingToUpdater) mfToCell.putIfAbsent(source, c) .getOrElse(c) }