-
Notifications
You must be signed in to change notification settings - Fork 1
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
Simplification Pass DSA #336
Conversation
3a57ba3
to
4b178eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments
src/main/scala/analysis/data_structure_analysis/IntervalDSA.scala
Outdated
Show resolved
Hide resolved
src/main/scala/analysis/data_structure_analysis/StackCleanUp.scala
Outdated
Show resolved
Hide resolved
@@ -313,7 +313,8 @@ case class SymbolicValues(state: Map[LocalVar, SymValueSet]) { | |||
.collect { case locVar: LocalVar if state.contains(locVar) => state(locVar) } | |||
.foldLeft(SymValueSet.empty)((result, operand) => result.join(operand)) | |||
.toTop | |||
case _ => | |||
case e @ _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure this is sound, there's a couple cases here making too-strong assumptions. The extract cases might be interesting to narrow with the known bits analysis (e.g. checking the high bits are zero for Extract(32, 0, body)) . We would probably also want to handle the case (R0 + R1 * constant). Maybe I'm missing something but it seems complex to expand this representation to arbitrary value analysis domains that don't represent every element, but I guess thats future work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think assuming that slicing/extracting a value preserves the pointers it represents (although it probably loses some precision). What is missing is that it could also represents other pointers but for the Extract(32, 0, body) case hopefully this is less of a concern since now we have 32 bit value.
For (R0 + R1 * constant), we could only handle it if for example R1 is a constant which will be removed in the copyprop.
StaticAnalysisConfig, | ||
StaticAnalysisContext | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the indirect call tests with the DSA to see if it will solve them? Indirect calls are definitely not a priority since we only have one in cntlm but it would be interesting to know.
src/main/scala/analysis/data_structure_analysis/IntervalDSA.scala
Outdated
Show resolved
Hide resolved
.sortBy(_.name) | ||
.foreach(proc => | ||
val SVAResults = getSymbolicValues(proc) | ||
val constraints = generateConstraints(proc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't put comments on Constraints.scala cause its not in the review but it could use the iterator over the procedure directly i.e. for (c: CFGPosition <- proc)
which will be more efficient than computeDomain but it will include non-reachable blocks.
src/main/scala/analysis/data_structure_analysis/SymbolicValueAnalysis.scala
Outdated
Show resolved
Hide resolved
src/main/scala/analysis/data_structure_analysis/IntervalDSA.scala
Outdated
Show resolved
Hide resolved
temp | ||
} | ||
|
||
def getPointee: IntervalCell = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invariant that every cell has a pointee cell? I'm not sure why if pointee is empty it creates a pointee
src/main/scala/analysis/data_structure_analysis/IntervalDSA.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge when you are happy with this
Data Structure Analysis re implemented to use simplification pass functionality.
use flag
--dsa none
to generate constraints or--dsa norm
to perform dsa(both require --simplify)
The following are changes from the DSA as it exists in main (--analyse flag):