Data flow analysis in JDT compiler [message #1015282] |
Wed, 27 February 2013 22:15  |
Eclipse User |
|
|
|
Hi everyone!
I'm looking for information about data flow analysis used by the JDT compiler.
Especially which different data flow analysis are used in the compiler and how they are working.
I know that most data flow stuff (e.g. optimizations) is done by the JVM and not by the sourcecode -> bytecode compiler but the Eclipse compiler is also able to give information about dead code for example.
Is there any documentation about what data flow techniques are used in JDT and how they are working?
Haven't found something about that.
Thanks and Greetings,
Gabriel
|
|
|
Re: Data flow analysis in JDT compiler [message #1015377 is a reply to message #1015282] |
Thu, 28 February 2013 07:22  |
Eclipse User |
|
|
|
What analysis is performed, can best be seen from this list of warning options:
http://help.eclipse.org/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm
Some of these operate at the level of type resolution but some do involve flow analysis. Some flow analysis is mandatory as per the JLS, other is specific to ECJ. Aside from the mandatory definite-assignment analysis the most sophisticated flow analysis is for detecting null dereferences, but, e.g., also the detection of (potential) resource leaks involves flow analysis.
Only few of these analyses are geared towards optimization (e.g., elimination of unused local variables), most relate in fact to the detection of potential programming problems.
If you want to learn how this analysis works, the point of reference is the source code.
The central infra structure for this can be found in
http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tree/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow
The details are implemented in analyseCode methods throughout all classes of the AST.
HTH,
Stephan
|
|
|
Powered by
FUDForum. Page generated in 0.03503 seconds