Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/metaproject #86

Draft
wants to merge 80 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3b3e206
Improved IFDS analysis, including demos and tests; by Mario Trageser
errt Mar 5, 2021
eb91c75
Merge branch 'develop' into feature/IDFS-improvements
errt May 27, 2021
31c4c6b
Create new project "ll"
buenaventure Jun 29, 2021
a26ee83
Add llvm bindings dependency
buenaventure Jun 29, 2021
9490098
Merge branch 'develop' into feature/IDFS-improvements
TorunR Jun 30, 2021
1a3b939
Read and dump module
buenaventure Jul 5, 2021
34d4e25
Begin implementing wrappers
buenaventure Jul 6, 2021
53da4de
Read instructions
buenaventure Jul 7, 2021
283ef68
AndroidEntryPointFinder added
Diarilex Jul 14, 2021
c88385a
Implement SimplePurityAnalysis which assumes everything to be Impure
buenaventure Nov 8, 2021
bca47d7
Merge branch 'develop' into feature/IDFS-improvements
TorunR Nov 10, 2021
c87f9ac
Implement SimplePurityAnalysis
buenaventure Nov 12, 2021
df11561
Implement viewCFG
buenaventure Nov 12, 2021
75f01ea
Merge pull request #3 from buenaventure/develop
buenaventure Dec 2, 2021
79cf52a
Merge remote-tracking branch 'upstream/develop' into ll
buenaventure Jan 5, 2022
905ad98
Add simple multilingual test project
buenaventure Jan 6, 2022
c624d84
Merge remote-tracking branch 'upstream/develop' into feature/IDFS-imp…
buenaventure Feb 17, 2022
bb079fd
Merge branch 'develop' into ll
buenaventure Feb 17, 2022
9ccee79
Add taint testcase
buenaventure Feb 5, 2022
6ab61f6
Merge branch 'feature/IDFS-improvements' into ll_multiling_ifds
buenaventure Feb 18, 2022
b99997c
Format code
buenaventure Feb 18, 2022
90c179a
Adapt new ifds to new call graph (with context)
buenaventure Feb 21, 2022
a464309
Add multilingual taint test
buenaventure Feb 23, 2022
7d00973
Extract IFDSProblem(flow functions etc) from IFDSAnalysis
buenaventure Mar 2, 2022
e3838cf
Replace specialized ifds analysis classes with parameter
buenaventure Mar 2, 2022
633c377
WIP
buenaventure Mar 5, 2022
cc84ea1
WIP
buenaventure Mar 10, 2022
cb4f4f7
WIP
buenaventure Mar 10, 2022
41d949c
WIP
buenaventure Mar 11, 2022
0b40422
WIP
buenaventure Mar 16, 2022
54bb807
WIP
buenaventure Mar 16, 2022
76a1c27
WIP (compiles)
buenaventure Mar 17, 2022
2bfaeea
Initialization fix
buenaventure Mar 17, 2022
6df8fab
Implement LLVM Argument, Type(s); Better Function/Instruction represe…
buenaventure Mar 18, 2022
f92c953
Move IFDS into separate project; Refactor handling of calls outside o…
buenaventure Mar 18, 2022
3931605
Re-implement ifds solver
buenaventure Mar 24, 2022
3ee3a04
Use new implementation for native part
buenaventure Mar 24, 2022
25d0f19
Implement forward taint analysis as test for new ifds solver
buenaventure Mar 25, 2022
3283b03
Fix new forward taint analysis
buenaventure Mar 31, 2022
313fd9a
Fix scalariformat and other compile errors
buenaventure Mar 31, 2022
75be229
Refactor: Move old code to .old, remove New prefix
buenaventure Apr 1, 2022
847baa5
First native flows working
buenaventure Apr 1, 2022
7d47c14
Fix native flows
buenaventure Apr 13, 2022
5e9cfaf
Cleanup
buenaventure May 6, 2022
16a99ae
Include llvm dependency using special sbt plugin
buenaventure May 6, 2022
89c1ff7
Fix sbt assembly
buenaventure May 11, 2022
89b91ca
Reverst scalastyle change
buenaventure May 11, 2022
91bae7d
Improve test case
buenaventure Jun 8, 2022
ed4ee71
Fix test
buenaventure Jun 9, 2022
626cce9
Fix wrong flow by adding successor to return flow and checking for ab…
buenaventure Jun 9, 2022
f34443b
Fix return flow of native code
buenaventure Jun 9, 2022
7284093
Format
buenaventure Jun 9, 2022
ab242a9
Add native to java calls to TaintTest
buenaventure Jun 16, 2022
c53aa61
Fix crashes and old tests
buenaventure Jun 17, 2022
943d7a1
Add debugData for ifds; Add simple GetElementPointer handling
buenaventure Jun 18, 2022
cb0be34
Native to Java calls WIP
buenaventure Jun 19, 2022
d3ab854
Small fixes
buenaventure Jun 22, 2022
b6a2202
JNI call analysis WIP
buenaventure Jun 25, 2022
e5d34a1
JNI call analysis WIP
buenaventure Jun 26, 2022
ec8c05a
Merge remote-tracking branch 'upstream/develop' into llvm_xlang_ifds
buenaventure Jun 30, 2022
ad65890
Fix most errors after merge
buenaventure Jun 30, 2022
c050890
Fix remaining errors after merge
buenaventure Jul 1, 2022
655d22a
Implement VTA in new IFDS for evaluation
buenaventure Jul 2, 2022
b844920
Implement Subsuming and add to evaluation
buenaventure Jul 2, 2022
d43fb11
x-lang working in simple case
buenaventure Jul 2, 2022
630162d
Bump javacpp version to work on M1 Macs.
Oct 4, 2022
52ac95c
Merge branch 'develop' into llvm_xlang_ifds
Oct 4, 2022
9786859
Remove old stuff, which should be superseded
Oct 4, 2022
91e92fa
Readd some not so obsolete Files and adapt to new IFDS Analysis
TorunR Oct 7, 2022
2d38159
Narfi ... fix Scala3 Syntax
TorunR Oct 7, 2022
4c93757
Autoformat and another backward hiccup
TorunR Oct 7, 2022
f67b853
Fix 2 small errors in llvm analysis
TorunR Oct 7, 2022
f766abb
Fix 2 other cases of scala 3 syntax.
TorunR Oct 7, 2022
55fea42
Move IFDS to si
TorunR Oct 11, 2022
42fa220
Add a language agnostic Metaproject
TorunR Oct 26, 2022
3848594
Merge branch 'develop' into feature/metaproject
TorunR Oct 27, 2022
7800e6f
Migrate TAC & AI to MetaProject
TorunR Oct 27, 2022
942f1ef
Adapt the other sub projects
TorunR Oct 28, 2022
9399a51
Fix Validate
TorunR Oct 28, 2022
e730d83
Merge branch 'develop' into feature/metaproject
TorunR Nov 15, 2022
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
Prev Previous commit
Next Next commit
Extract IFDSProblem(flow functions etc) from IFDSAnalysis
  • Loading branch information
buenaventure committed Mar 2, 2022
commit 7d009738227a5651be125cf774330ec4045bd446
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.opalj.tac.fpcf.properties.cg.Callers
import org.opalj.ai.domain.l2
import org.opalj.ai.fpcf.properties.AIDomainFactoryKey
import org.opalj.tac.fpcf.analyses.heros.cfg.OpalICFG
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.Assignment
import org.opalj.tac.Call
import org.opalj.tac.ExprStmt
Expand All @@ -40,7 +40,7 @@ import org.opalj.tac.fpcf.analyses.ifds.AbstractIFDSAnalysis.V
* @author Mario Trageser
*/
abstract class HerosAnalysis[F](p: SomeProject, icfg: OpalICFG)
extends DefaultIFDSTabulationProblem[Statement, F, Method, OpalICFG](icfg) {
extends DefaultIFDSTabulationProblem[JavaStatement, F, Method, OpalICFG](icfg) {

/**
* The project's property store.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.opalj.br.analyses.DeclaredMethodsKey
import org.opalj.br.fpcf.PropertyStoreKey
import org.opalj.br.DeclaredMethod
import org.opalj.tac.fpcf.properties.cg.Callees
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.Assignment
import org.opalj.tac.Expr
import org.opalj.tac.GetStatic
Expand Down Expand Up @@ -59,8 +59,8 @@ class HerosVariableTypeAnalysis(
initialMethods: Map[Method, util.Set[VTAFact]]
) extends HerosAnalysis[VTAFact](p, icfg) {

override val initialSeeds: util.Map[Statement, util.Set[VTAFact]] = {
var result: Map[Statement, util.Set[VTAFact]] = Map.empty
override val initialSeeds: util.Map[JavaStatement, util.Set[VTAFact]] = {
var result: Map[JavaStatement, util.Set[VTAFact]] = Map.empty
for ((m, facts) ← initialMethods) {
result += icfg.getStartPointsOf(m).iterator().next() -> facts
}
Expand All @@ -69,13 +69,13 @@ class HerosVariableTypeAnalysis(

override def createZeroValue(): VTAFact = VTANullFact

override protected def createFlowFunctionsFactory(): FlowFunctions[Statement, VTAFact, Method] = {
override protected def createFlowFunctionsFactory(): FlowFunctions[JavaStatement, VTAFact, Method] = {

new FlowFunctions[Statement, VTAFact, Method]() {
new FlowFunctions[JavaStatement, VTAFact, Method]() {

override def getNormalFlowFunction(
statement: Statement,
succ: Statement
statement: JavaStatement,
succ: JavaStatement
): FlowFunction[VTAFact] = {
if (!insideAnalysisContext(statement.method)) return KillAll.v()
val stmt = statement.stmt
Expand Down Expand Up @@ -103,7 +103,7 @@ class HerosVariableTypeAnalysis(
}
}

override def getCallFlowFunction(stmt: Statement, callee: Method): FlowFunction[VTAFact] =
override def getCallFlowFunction(stmt: JavaStatement, callee: Method): FlowFunction[VTAFact] =
if (!insideAnalysisContext(callee)) KillAll.v()
else {
val callObject = asCall(stmt.stmt)
Expand All @@ -129,10 +129,10 @@ class HerosVariableTypeAnalysis(
}

override def getReturnFlowFunction(
stmt: Statement,
stmt: JavaStatement,
callee: Method,
exit: Statement,
succ: Statement
exit: JavaStatement,
succ: JavaStatement
): FlowFunction[VTAFact] =
if (exit.stmt.astID == ReturnValue.ASTID && stmt.stmt.astID == Assignment.ASTID) {
val returnValue = exit.stmt.asReturnValue.expr.asVar
Expand All @@ -147,8 +147,8 @@ class HerosVariableTypeAnalysis(
} else KillAll.v()

override def getCallToReturnFlowFunction(
statement: Statement,
succ: Statement
statement: JavaStatement,
succ: JavaStatement
): FlowFunction[VTAFact] = {
if (!insideAnalysisContext(statement.method)) return KillAll.v()
val stmt = statement.stmt
Expand Down Expand Up @@ -227,7 +227,7 @@ class HerosVariableTypeAnalysis(
callee.body.isDefined && (callee.classFile.fqn.startsWith("java/lang") ||
callee.classFile.fqn.startsWith("org/opalj/fpcf/fixtures/vta"))

private def getCallees(statement: Statement): Iterator[DeclaredMethod] = {
private def getCallees(statement: JavaStatement): Iterator[DeclaredMethod] = {
val context = typeProvider.newContext(declaredMethods(statement.method))
val FinalEP(_, callees) = propertyStore(declaredMethods(statement.method), Callees.key)
callees.directCallees(context, statement.stmt.pc).map(_.method)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.opalj.tac.cg.RTACallGraphKey
import org.opalj.tac.fpcf.analyses.heros.cfg.OpalForwardICFG
import org.opalj.tac.fpcf.analyses.ifds.CalleeType
import org.opalj.tac.fpcf.analyses.ifds.IFDSBasedVariableTypeAnalysis
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.fpcf.analyses.ifds.VariableType
import org.opalj.tac.fpcf.analyses.ifds.VTAFact
import org.opalj.tac.fpcf.analyses.ifds.VTANullFact
Expand Down Expand Up @@ -115,7 +115,7 @@ object VTAEquality {
piKeyUnidueId != PropertyStoreKey.uniqueId
}
val propertyStore = project.get(PropertyStoreKey)
var result = Map.empty[Statement, Set[VTAFact]]
var result = Map.empty[JavaStatement, Set[VTAFact]]
project.updateProjectInformationKeyInitializationData(AIDomainFactoryKey) {
case None ⇒ Set(classOf[l2.DefaultPerformInvocationsDomainWithCFGAndDefUse[_]])
case Some(requirements) ⇒
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.opalj.br.Method
import org.opalj.br.ObjectType
import org.opalj.tac.fpcf.analyses.heros.cfg.OpalBackwardICFG
import org.opalj.tac.fpcf.analyses.ifds.taint.Fact
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.Assignment
import org.opalj.tac.fpcf.analyses.ifds.taint.ArrayElement
import org.opalj.tac.fpcf.analyses.ifds.taint.Variable
Expand All @@ -40,7 +40,7 @@ import org.opalj.tac.ReturnValue
import org.opalj.tac.fpcf.analyses.heros.analyses.HerosAnalysis
import org.opalj.tac.fpcf.analyses.heros.analyses.HerosAnalysisRunner
import org.opalj.tac.fpcf.analyses.ifds.taint.FlowFact
import org.opalj.tac.fpcf.analyses.ifds.taint.TaintAnalysis
import org.opalj.tac.fpcf.analyses.ifds.taint.TaintProblem
import org.opalj.tac.fpcf.analyses.ifds.AbstractIFDSAnalysis

/**
Expand All @@ -51,7 +51,7 @@ import org.opalj.tac.fpcf.analyses.ifds.AbstractIFDSAnalysis
*/
class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG) extends HerosTaintAnalysis(p, icfg) {

override val initialSeeds: util.Map[Statement, util.Set[Fact]] =
override val initialSeeds: util.Map[JavaStatement, util.Set[Fact]] =
p.allProjectClassFiles.filter(classFile ⇒
classFile.thisType.fqn == "java/lang/Class")
.flatMap(classFile ⇒ classFile.methods)
Expand All @@ -62,11 +62,11 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)

override def followReturnsPastSeeds(): Boolean = true

override def createFlowFunctionsFactory(): FlowFunctions[Statement, Fact, Method] = {
override def createFlowFunctionsFactory(): FlowFunctions[JavaStatement, Fact, Method] = {

new FlowFunctions[Statement, Fact, Method]() {
new FlowFunctions[JavaStatement, Fact, Method]() {

override def getNormalFlowFunction(statement: Statement, succ: Statement): FlowFunction[Fact] = {
override def getNormalFlowFunction(statement: JavaStatement, succ: JavaStatement): FlowFunction[Fact] = {
val method = statement.method
val stmt = statement.stmt
source: Fact ⇒ {
Expand All @@ -77,7 +77,7 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)
else Set(source)
case ArrayStore.ASTID ⇒
val arrayStore = stmt.asArrayStore
val arrayIndex = TaintAnalysis.getIntConstant(arrayStore.index, statement.code)
val arrayIndex = TaintProblem.getIntConstant(arrayStore.index, statement.code)
val arrayDefinedBy = arrayStore.arrayRef.asVar.definedBy
var facts = (source match {
// In this case, we taint the whole array.
Expand Down Expand Up @@ -127,7 +127,7 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)

}

override def getCallFlowFunction(stmt: Statement, callee: Method): FlowFunction[Fact] = {
override def getCallFlowFunction(stmt: JavaStatement, callee: Method): FlowFunction[Fact] = {
val callObject = asCall(stmt.stmt)
val staticCall = callee.isStatic
source: Fact ⇒ {
Expand Down Expand Up @@ -169,7 +169,7 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)
}
}

override def getReturnFlowFunction(statement: Statement, callee: Method, exit: Statement, succ: Statement): FlowFunction[Fact] = {
override def getReturnFlowFunction(statement: JavaStatement, callee: Method, exit: JavaStatement, succ: JavaStatement): FlowFunction[Fact] = {
// If a method has no caller, returnFlow will be called with a null statement.
if (statement == null) return Identity.v()
val stmt = statement.stmt
Expand Down Expand Up @@ -199,7 +199,7 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)
}).asJava
}

override def getCallToReturnFlowFunction(stmt: Statement, succ: Statement): FlowFunction[Fact] =
override def getCallToReturnFlowFunction(stmt: JavaStatement, succ: JavaStatement): FlowFunction[Fact] =
Identity.v()
}
}
Expand All @@ -221,12 +221,12 @@ class HerosBackwardClassForNameAnalysis(p: SomeProject, icfg: OpalBackwardICFG)
}.toSet
}

private def createNewTaints(expression: Expr[V], statement: Statement): Set[Fact] =
private def createNewTaints(expression: Expr[V], statement: JavaStatement): Set[Fact] =
expression.astID match {
case Var.ASTID ⇒ expression.asVar.definedBy.map(Variable)
case ArrayLoad.ASTID ⇒
val arrayLoad = expression.asArrayLoad
val arrayIndex = TaintAnalysis.getIntConstant(expression.asArrayLoad.index, statement.code)
val arrayIndex = TaintProblem.getIntConstant(expression.asArrayLoad.index, statement.code)
val arrayDefinedBy = arrayLoad.arrayRef.asVar.definedBy
if (arrayIndex.isDefined) arrayDefinedBy.map(ArrayElement(_, arrayIndex.get))
else arrayDefinedBy.map(Variable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.opalj.tac.PutField
import org.opalj.tac.PutStatic
import org.opalj.tac.ReturnValue
import org.opalj.tac.Var
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.fpcf.analyses.ifds.taint.ArrayElement
import org.opalj.tac.fpcf.analyses.ifds.taint.Fact
import org.opalj.tac.fpcf.analyses.ifds.taint.FlowFact
Expand All @@ -50,7 +50,7 @@ import org.opalj.tac.PrefixExpr
import org.opalj.tac.PrimitiveTypecastExpr
import org.opalj.tac.fpcf.analyses.heros.analyses.HerosAnalysis
import org.opalj.tac.fpcf.analyses.heros.analyses.HerosAnalysisRunner
import org.opalj.tac.fpcf.analyses.ifds.taint.TaintAnalysis
import org.opalj.tac.fpcf.analyses.ifds.taint.TaintProblem
import org.opalj.tac.fpcf.analyses.ifds.AbstractIFDSAnalysis
import org.opalj.tac.fpcf.analyses.ifds.AbstractIFDSAnalysis.V

Expand All @@ -66,8 +66,8 @@ class HerosForwardClassForNameAnalysis(
initialMethods: Map[Method, util.Set[Fact]]
) extends HerosTaintAnalysis(p, icfg) {

override val initialSeeds: util.Map[Statement, util.Set[Fact]] = {
var result: Map[Statement, util.Set[Fact]] = Map.empty
override val initialSeeds: util.Map[JavaStatement, util.Set[Fact]] = {
var result: Map[JavaStatement, util.Set[Fact]] = Map.empty
for ((m, facts) ← initialMethods) {
result += icfg.getStartPointsOf(m).iterator().next() -> facts
}
Expand All @@ -78,18 +78,18 @@ class HerosForwardClassForNameAnalysis(

var flowFacts = Map.empty[Method, Set[FlowFact]]

override def createFlowFunctionsFactory(): FlowFunctions[Statement, Fact, Method] = {
override def createFlowFunctionsFactory(): FlowFunctions[JavaStatement, Fact, Method] = {

new FlowFunctions[Statement, Fact, Method]() {
new FlowFunctions[JavaStatement, Fact, Method]() {

override def getNormalFlowFunction(stmt: Statement, succ: Statement): FlowFunction[Fact] = {
override def getNormalFlowFunction(stmt: JavaStatement, succ: JavaStatement): FlowFunction[Fact] = {
stmt.stmt.astID match {
case Assignment.ASTID ⇒
handleAssignment(stmt, stmt.stmt.asAssignment.expr)
case ArrayStore.ASTID ⇒
val store = stmt.stmt.asArrayStore
val definedBy = store.arrayRef.asVar.definedBy
val index = TaintAnalysis.getIntConstant(store.index, stmt.code)
val index = TaintProblem.getIntConstant(store.index, stmt.code)
(source: Fact) ⇒ {
if (isTainted(store.value, source)) {
if (index.isDefined) {
Expand Down Expand Up @@ -131,7 +131,7 @@ class HerosForwardClassForNameAnalysis(
}
}

def handleAssignment(stmt: Statement, expr: Expr[V]): FlowFunction[Fact] =
def handleAssignment(stmt: JavaStatement, expr: Expr[V]): FlowFunction[Fact] =
expr.astID match {
case Var.ASTID ⇒
(source: Fact) ⇒ {
Expand All @@ -148,7 +148,7 @@ class HerosForwardClassForNameAnalysis(
source match {
// The specific array element may be tainted
case ArrayElement(index, taintedIndex) ⇒
val arrIndex = TaintAnalysis.getIntConstant(load.index, stmt.code)
val arrIndex = TaintProblem.getIntConstant(load.index, stmt.code)
if (arrayDefinedBy.contains(index) &&
(arrIndex.isEmpty || taintedIndex == arrIndex.get))
TwoElementSet.twoElementSet(source, Variable(stmt.index))
Expand Down Expand Up @@ -198,7 +198,7 @@ class HerosForwardClassForNameAnalysis(
case _ ⇒ Identity.v()
}

override def getCallFlowFunction(stmt: Statement, callee: Method): FlowFunction[Fact] = {
override def getCallFlowFunction(stmt: JavaStatement, callee: Method): FlowFunction[Fact] = {
val callObject = asCall(stmt.stmt)
val allParams = callObject.allParams
if (relevantCallee(callee)) {
Expand Down Expand Up @@ -252,10 +252,10 @@ class HerosForwardClassForNameAnalysis(
}

override def getReturnFlowFunction(
stmt: Statement,
stmt: JavaStatement,
callee: Method,
exit: Statement,
succ: Statement
exit: JavaStatement,
succ: JavaStatement
): FlowFunction[Fact] = {

def isRefTypeParam(index: Int): Boolean =
Expand Down Expand Up @@ -348,8 +348,8 @@ class HerosForwardClassForNameAnalysis(
}

override def getCallToReturnFlowFunction(
stmt: Statement,
succ: Statement
stmt: JavaStatement,
succ: JavaStatement
): FlowFunction[Fact] =
Identity.v()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.collection.JavaConverters._
import org.opalj.br.analyses.SomeProject
import org.opalj.br.Method
import org.opalj.br.cfg.BasicBlock
import org.opalj.tac.fpcf.analyses.ifds.Statement
import org.opalj.tac.fpcf.analyses.ifds.JavaStatement
import org.opalj.tac.TACode

/**
Expand All @@ -22,31 +22,31 @@ import org.opalj.tac.TACode
*/
class OpalBackwardICFG(project: SomeProject) extends OpalICFG(project) {

override def getPredsOf(stmt: Statement): JList[Statement] = super.getSuccsOf(stmt)
override def getPredsOf(stmt: JavaStatement): JList[JavaStatement] = super.getSuccsOf(stmt)

override def getSuccsOf(stmt: Statement): JList[Statement] = super.getPredsOf(stmt)
override def getSuccsOf(stmt: JavaStatement): JList[JavaStatement] = super.getPredsOf(stmt)

override def getStartPointsOf(m: Method): JCollection[Statement] = {
override def getStartPointsOf(m: Method): JCollection[JavaStatement] = {
val TACode(_, code, _, cfg, _) = tacai(m)
(cfg.normalReturnNode.predecessors ++ cfg.abnormalReturnNode.predecessors).map {
case bb: BasicBlock ⇒
val index = bb.endPC
Statement(m, bb, code(index), index, code, cfg)
JavaStatement(m, bb, code(index), index, code, cfg)
}.asJava
}

override def isExitStmt(stmt: Statement): Boolean = stmt.index == 0
override def isExitStmt(stmt: JavaStatement): Boolean = stmt.index == 0

override def isStartPoint(stmt: Statement): Boolean = {
override def isStartPoint(stmt: JavaStatement): Boolean = {
val cfg = stmt.cfg
val index = stmt.index
(cfg.normalReturnNode.predecessors ++ cfg.abnormalReturnNode.predecessors).exists {
case bb: BasicBlock ⇒ bb.endPC == index
}
}

override def allNonCallStartNodes(): JSet[Statement] = {
val res = new ConcurrentLinkedQueue[Statement]
override def allNonCallStartNodes(): JSet[JavaStatement] = {
val res = new ConcurrentLinkedQueue[JavaStatement]
project.parForeachMethodWithBody() { mi ⇒
val m = mi.method
val TACode(_, code, _, cfg, _) = tacai(m)
Expand All @@ -58,7 +58,7 @@ class OpalBackwardICFG(project: SomeProject) extends OpalICFG(project) {
var index = 0
while (index < endIndex) {
val stmt = code(index)
val statement = Statement(m, cfg.bb(index), stmt, index, code, cfg)
val statement = JavaStatement(m, cfg.bb(index), stmt, index, code, cfg)
if (!(isCallStmt(statement) || startIndices.contains(index)))
res.add(statement)
index += 1
Expand All @@ -68,10 +68,10 @@ class OpalBackwardICFG(project: SomeProject) extends OpalICFG(project) {
Collections.emptySet()
}

def getExitStmt(method: Method): Statement = {
def getExitStmt(method: Method): JavaStatement = {
val tac = tacai(method)
val cfg = tac.cfg
val code = tac.stmts
Statement(method, cfg.startBlock, code(0), 0, code, cfg)
JavaStatement(method, cfg.startBlock, code(0), 0, code, cfg)
}
}
Loading