Phase 5
Goal
In this phase we will implement RTA and will use it to gather
coverage statistics similar to the ones from phase 4. By using a more precise
analysis, a coverage tool can report more informative coverage results to a tool
user. If the analysis is imprecise, the coverage metrics become hard to
interpret — e.g. if only 50% coverage is achieved, is this because the tests are
incomplete, or is it because the tool was just confused by the imprecise
analysis, and we actually have high coverage? The goal of this phase is to
determine the difference between CHA and RTA with respect to the coverage
metrics.
Overall Structure
The infrastructure is controlled by two scripts:
"run1" and "run2", corresponding to the following two stages
- Stage 1: Implement RTA and test it on a set of small programs (p5, p7, and
p8). This is done through script "run1".
- Stage 2: Repeat the experiments from phase 4 on the four CUT, but use RTA
instead of CHA. This done through script "run2".
Stage 1
The starting point for the RTA implementation is a working
implementation of CHA in phase5.tar.gz. The only class that will have to be
changed is RtaAnalysis. There are two kinds of changes. First, changes to the
algorithm need to be implemented (e.g., deciding whether to put a methods on the
worklist). For this, you need to figure out when a class is instantiated. If you
have a Stmt s in JIMPLE, it contains a "new X" expression only if s is an
instance of DefinitionStmt and s.getRightOp() is an instance of NewExpr (i.e.,
the right-hand side is "new X"). To find which SootClass is being allocated, you
can use rhs.getBaseType().getSootClass(), where rhs is the right-hand side of s.
For more details on these classes and methods, check out the Soot API
documentation.
The second kind of changes you need to make are related to calls from
RtaAnalysis to RtaWriter. RtaWriter is the class responsible for creating output
files rmethods, rmethods.cut, nmethods.cut, edges, edges.cut, and calls.
RtaAnalysis calls several methods from RtaWriter:
- registerSimpleCall(call_site): should be called once for each
staticinvoke and specialinvoke call site in each reachable method.
- registerComplexCall(call_site): should be called once for each
virtualinvoke and interfaceinvoke call site in each reachable method.
- registerReceiverClass(call_site,rcv_class): should be called at
least once for each receiver class that RTA determines to be a possibility at
a "complex" call site. All calls for a particular call site should come after
registerComplexCall had been invoked for that call site.
To understand
the calls from RtaAnalysis to RtaWriter, read carefully to source code in
RtaAnalysis.java.
Stage 2
Done similarly to phase 4.