Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion OPAL/tac/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1702,10 +1702,15 @@ org.opalj {
"UnsafePointsTo",
"SerializationAllocations",
"NewInstance",
"ReflectionAllocationsAnalysisScheduler",
"org.opalj.tac.fpcf.analyses.fieldaccess.TriggeredFieldAccessInformationAnalysis",
"org.opalj.tac.fpcf.analyses.fieldaccess.reflection.ReflectionRelatedFieldAccessesAnalysisScheduler",
]
},
AllocationSites {
# Modules (analyses for different functionalities) to be used when tracking allocation sites in call graph construction
modules = [
"org.opalj.tac.fpcf.analyses.pointsto.ReflectionAllocationsAnalysisScheduler"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,32 @@ package org.opalj
package tac
package cg

import scala.jdk.CollectionConverters.*

import org.opalj.br.analyses.ProjectInformationKey
import org.opalj.br.analyses.SomeProject
import org.opalj.br.fpcf.FPCFAnalysisScheduler
import org.opalj.br.fpcf.properties.SimpleContexts
import org.opalj.br.fpcf.properties.SimpleContextsKey
import org.opalj.log.LogContext
import org.opalj.tac.fpcf.analyses.cg.AllocationSitesPointsToTypeIterator

trait AllocationSiteBasedPointsToCallGraphKey extends PointsToCallGraphKey {

override protected def registeredAnalyses(project: SomeProject): scala.collection.Seq[FPCFAnalysisScheduler] = {
implicit val logContext: LogContext = project.logContext
val config = project.config

// TODO use FPCFAnalysesRegistry here
super.registeredAnalyses(project) ++ config.getStringList(
"org.opalj.tac.cg.AllocationSites.modules"
).asScala.flatMap { moduleName =>
resolveAnalysisRunner(if (moduleName.contains('.')) moduleName else getModuleFQN(moduleName))
}
}

}

/**
* A [[org.opalj.br.analyses.ProjectInformationKey]] to compute a [[CallGraph]] based on
* the points-to analysis.
Expand All @@ -17,7 +37,7 @@ import org.opalj.tac.fpcf.analyses.cg.AllocationSitesPointsToTypeIterator
*
* @author Florian Kuebler
*/
object AllocationSiteBasedPointsToCallGraphKey extends PointsToCallGraphKey {
object AllocationSiteBasedPointsToCallGraphKey extends AllocationSiteBasedPointsToCallGraphKey {

override val pointsToType: String = "AllocationSiteBased"
override val contextKey: ProjectInformationKey[SimpleContexts, Nothing] = SimpleContextsKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.opalj.tac.fpcf.analyses.cg.TypesBasedPointsToTypeIterator
*
* @author Dominik Helm
*/
object CFA_1_0_CallGraphKey extends PointsToCallGraphKey {
object CFA_1_0_CallGraphKey extends AllocationSiteBasedPointsToCallGraphKey {

override val pointsToType: String = "TypeBased"
override val contextKey: ProjectInformationKey[CallStringContexts, Nothing] = CallStringContextsKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.opalj.tac.fpcf.analyses.cg.CFA_k_l_TypeIterator
*
* @author Dominik Helm
*/
object CFA_1_1_CallGraphKey extends PointsToCallGraphKey {
object CFA_1_1_CallGraphKey extends AllocationSiteBasedPointsToCallGraphKey {

override val pointsToType: String = "AllocationSiteBased"
override val contextKey: ProjectInformationKey[CallStringContexts, Nothing] = CallStringContextsKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ trait PointsToCallGraphKey extends CallGraphKey {
}
}

private def getModuleFQN(moduleName: String): String = {
protected def getModuleFQN(moduleName: String): String = {
s"org.opalj.tac.fpcf.analyses.pointsto.${pointsToType}${moduleName}AnalysisScheduler"
}
}