Information Technology Reference
In-Depth Information
1 public static void main(String args[]) {
2 Connection c1 = new Connection(args[0]);
3 Connection c2 = new Connection(args[0]);
4 c1.close();
5 c1.write(args[1]);
6 c1.write(args[1]);
7 c2.close();
8 c2.write(args[1]);
9 c2.close();
10 c2.write(args[1]);
11 }
1 public void m(String args[]) {
2 for(int i = 0; i < 10; i++)
3 {
4 Connection c1 = new Connection(args[0]);
5 c1.write(args[1]);
6 c1.close();
7
}
8 }
(b) An example similar to the example in figure 4
(a) A program similar to the program in figure 3
Fig. 5. Examples on which optimizations have no effect
Therefore, we can further optimize NSA based on the local objects created in
loop statements, which will be the future work.
Finally, we should note that even if the original NSA is inter-procedural flow-
sensitive, it could not remove the shadows in Figure 2 and Figure 3 either. Hence,
the main ideas of our optimizations can also be used in the inter-procedural flow-
sensitive static analysis.
6 Related Work
Recently, typestate analysis of large-scale programs attracts much attention,
and several static and dynamic typestate analysis methods are proposed and
implemented. In [13], Fink et al. propose a context-sensitive, flow-sensitive and
integrated static typestate verifier. The verifier utilizes a combined abstract do-
main of typestate and pointer abstractions to improve the precision of alias
analysis. Their static analysis framework is designed to be a staged system to
improve the scalability and eciency. However, their approach cannot verify the
typestate specifications of multiple objects. In [18], a hybrid typestate analy-
sis is proposed and implemented to be context-sensitive and inter-procedural
flow-sensitive. The static analysis in [18] is based on a lattice-based operational
semantics, which supports to track individual objects along control-flow paths
and compute typestate information and points-to information simultaneously.
However, their approach suffers from unsoundness problem [7]. Besides those
work, Rahul Purandare presents in [20] a cost model for runtime monitoring.
The model explains key factors of monitoring overhead and the relationship
among them. The cost model guides the optimization of runtime monitoring.
Different from the hybrid method in this paper, the approach in [20] also tries to
remove instrumentations at runtime [21]. Furthermore, their optimization can
reduce the runtime overhead by reclaiming unnecessary monitors. Whereas, their
hybrid approach may easily lead to unacceptable overhead at runtime, especially
for the typestate properties involving multiple interacting objects. In addition,
when unchecked exceptions happen, the method may produce unsound results.
 
Search WWH ::




Custom Search