From 1c1d341199c3e6bd0282f09f9b41dc6ac1e6cfb4 Mon Sep 17 00:00:00 2001 From: Dominik Helm Date: Thu, 24 Oct 2019 13:41:36 +0200 Subject: [PATCH 1/2] Set parallelism for PurityAnalysis on command line --- .../com/phaller/rasync/test/opal/PurityAnalysis.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 From 07370565ed201793f5dc5deae95bfe30d1f1bc1c Mon Sep 17 00:00:00 2001 From: Dominik Helm Date: Wed, 29 Jan 2020 13:11:00 +0100 Subject: [PATCH 2/2] Use monotonic updater --- .../test/opal/ifds/AbstractIFDSAnalysis.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) }