[abc] Promising results for static optimization of SafeEnumeration

From: Eric Bodden <eric.bodden@mail.mcgill.ca>
Date: Sat Aug 19 2006 - 16:44:19 BST

Hi all.

I just got the static analysis completely working. I was still using context information during the last days which made it all quite imprecise, but now we seem fine at least for easier examples. One of those is SafeEnumeration as it does not require filtering and hence no must-alias analysis.

Example program: (tracematch as usual)

        public static void main(String[] args) {
                foo();
                bar();
        }
        
        static void foo() {
                Vector c1 = new Vector();
                c1.add("");
                for (Enumeration iter = c1.elements(); iter.hasMoreElements();) {
                        iter.nextElement();
                }
                //this method is safe; weave nothing
        }
        
        static void bar() {
                Vector c2 = new Vector();
                c2.add(""); //this does not contribute to the match and is not matched either
                Enumeration iterator = c2.elements(); //this is an active shadow
                iterator.nextElement(); //and this
                c2.add(""); //and this
                iterator.nextElement(); //and this (error state)
        }

Analysis result:

==================================================================
Shadow statistic following
==================================================================
Tracematch 'tracematch$0':
8 (100%) advice applications before optimization
4 (50%) advice applications removed due to analysis
4 (50%) advice applications remaining
==================================================================

I will no first do some refactorings, document and clean up the code and then I will try some real benchmarks.

Cheers,
Eric

--
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada
Received on Sat Aug 19 16:44:37 2006

This archive was generated by hypermail 2.1.8 : Tue Mar 06 2007 - 16:13:29 GMT