[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cheap low-level info?
I've been experimenting recently with some whole-program analysis.
(specifically alias analysis, but I think this applies to other
whole program analysis as well)
Javac is capable of doing fairly extensive global analysis quickly.
How? It doesn't attempt to build a syntax tree.
Using Soot, things really bog down alot and memory usage through the roof,
mostly because you have to keep all these syntax trees around! Unfortunately,
for a nice, easy to manipulate high-level representation, there is not really
any way to get around this.. (and from my experience, I think soot is
actually
reasonably efficient in this respect)
So, the question is: are there ways of doing meaningful whole program
analysis without
creating a syntax tree? Yes! The question is what information can I get
cheaply
directly from the bytecode. Context classes provide some information (like the
methods and interfaces) without syntax trees for the bodies of any methods.
I think there is other information that can be extracted as well:
1) Method call graphs.
2) Fields that are lvalues. (This is important when doing dataflow through
fields in the context of method calls.)
3) Whether or not reflection is used. (Important if you want to ensure the
validity of optimizations based on class hierarchy)
4) Imported classes. (Think: An abstraction of a method call graph that
treats all the methods in a class as a single node)
These are all useful abstractions of a method body that do not require the
memory overhead of a syntax tree.
Any ideas on how to build this into soot? From what I've seen, the
bytecode is gone after load the class from coffi, correct?
Steve