Skip to content

Implementation of several scheduling methods to improve the performance of static analyses #263

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

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from

Conversation

19Vik19
Copy link
Contributor

@19Vik19 19Vik19 commented May 6, 2025

Static subanalyses are divided into different batches and summarized by the strategies in order to shorten the runtime.
This approach offers 4 strategies:
Single Phase Scheduling (SPS) - All sub-analyses are put into one batch and executed (may lead to wrong results in some cases. Further research needed).
Maximum Phase Scheduling (MP)- This strategy tries to create the most phases from the given analyses.
Independent Phase Merge Scheduling (IPMS) - An extension of the MPS strategy that executes independent phases together.
Smallest Phase Merge Scheduling (SPMS) - Also an extension of the MPS strategy, which merges independent phases into one phase based on the number of partial analyses.

There is also a Lazy Transformer Multiple Phase Flag, which allows the analyses to schedule lazy and transformer partial analyses in multiple phases.

This reverts commit 0d3ba57.
…erTest.scala eingepflegt, erste Anfänge Purity anzupassen
# Conflicts:
#	DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Immutability.scala
#	OPAL/si/src/main/scala/org/opalj/fpcf/seq/PKESequentialPropertyStore.scala
- Missing Uses
- Callgraph can now be calulated in another phase, and dont need to be  in the first phase
- FieldLocalityAnalyses error when handling new Callers
…es at once.

Old immutability with manual batching is also included in the folder
…asurement

# Conflicts:
#	OPAL/tac/src/main/scala/org/opalj/tac/fpcf/analyses/cg/DoPrivilegedCGAnalysis.scala
…r the handleNewCallers method in the FieldLocalityAnalysis.scala
@@ -4,7 +4,7 @@ org.opalj {
// to support the debugging of analyses developed using the property store.
// I.e., debug performs a wide range of additionaly checks to identify errors as
// early as possible.
fpcf.PropertyStore.Debug = false
fpcf.PropertyStore.Debug = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change

if (cleanUpSubPhase.isEmpty) {
finalizationOrder.toArray
(propertyKindsComputedInThisPhase -- finalizationOrder.flatten.toSet)
this.subPhaseFinalizationOrder = (if (cleanUpSubPhase.isEmpty) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not pretty. Can it be cleaned up? At least it should be documented what it's doing.

val scenario = AnalysisScenario(Set(eager1, eager3, eager4, eager5, eager6, eager2, lazy1, lazy2, lazy3, transformer1, triggered1, triggered2, triggered3), ps)
val schedule = scenario.computeSchedule(ps)

print(schedule.batches)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a test if it just prints stuff

@@ -44,6 +43,114 @@ class PropertyComputationsSchedulerTest extends AnyFunSpec with Matchers with Be
derivesEagerly = Set(PropertyBounds.lub(pks(1)))
)

def analysis1IsScheduledBeforeOrAtTheSameBatchAsAnalysis2(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these methods for? They don't seem to be used

/**
* This ImmutabilityRunner has been adapted for the scheduling strategies. This means that all analyses are transferred to one scheduler,
* whereby the call graph is transferred to the scheduler with the other analyses in “dependencies”.
* The original immutability analysis is the "Immutability.scala".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge into the original runner or remove, we can't maintain two almost identical ones.

counter = counter + 1
}

val transformedGraph = preparedGraph.map { case (node, deps) =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name is not descriptive

sortedNodes = sortedNodes :+ node
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert blank line after method definition

}

sortedNodes
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert blank line after method definition

def mergeIndependentBatches(
tfMap: Map[Int, List[Int]],
ct: Int,
graph: Map[Int, List[Int]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names are not descriptive

graph: Map[Int, List[Int]]
): Map[Int, List[Int]] = {

var allUses: Set[Int] = Set.empty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mutable variable seems like a bad design choice

@errt
Copy link
Collaborator

errt commented May 6, 2025

Formatting also needs to be applied: sbt scalafmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants