| Specialization is a program optimization technology based on periodical computations. Partial Evaluation and Data Specialization are both Specialization technologies as they both optimize programs by early-staged computations, which depend on the early values. Partial Evaluation works well except that it induces code explosion, which countervaisl the benefits from optimization, and Data Specialization encodes the early results in data structures, thus mends the explosion problems. However, Data Specialization can't specialize the program control flows. Partial Evaluation and Data Specialization have always been studies separately, with their results in their separate field, but they can't solve the explosion and control problem.This paper combines Partial Evaluation and Data Specialization, comes with a specialization technology based on Control Flow Graph. It specializes the programs control flows with Data Specialization and the base blocks with Partial Evaluation. And it can generate the residential program for both compile-time specialization and run-time specialization. It adopts the pattern of off-line Partial Evaluation with BTA(Binding Time Analysis) to improve the performance of the residential program.This paper implements a control-flow-graph based dynamic specialization system for Java Programs. It focus on the Parser/Scanner of annotation programs with bta,.CFG(Control Flow Graph) systems, auto-generation of compile-time CFG and auto-generation of residential programs etc.. This specialization system explores the theory and method of specialization and extends its application to Java program. Also this system can optimize Java programs with the description and value of early values, thus becoming a tool for Java program optimization in special circumstance. |