The Java Compiler Middle Pass

The middle pass takes syntactically and semantically correct Java abstract syntax trees (AST) and builds a control flow graph for the Java objects. While building the control flow graph, local common subexpressions can be eliminated and local constants can be propagated (where "local" means within a basic block).

The middle pass itself has two sub-passes. The first pass selectively transforms the AST and the second builds the flow graph.

AST to AST transformation restructures the Java AST. For example, an interface definition may contain executable statements (e.g., object creation via new). These statements must be collected into an invisible method that is executed before the constructor or any other method when an object implementing that method is created.

Virtual method tables for objects and interface method tables are implied in Java. In the transformation pass they are made explicit.

Ian Kaplan, April 1, 2000 revised:


back to Java page