Journal "Software Engineering"
a journal on theoretical and applied science and technology
ISSN 2220-3397

Issue N8 2014 year

Method Reachability Analysis and Selective Class Initialization for Java Programs
A. V. Pilipenko, Postgraduate Student, SPbSU, e-mail: artur.pilipenko@gmail.com, O. A. Pliss, Principal Member of Technical Staff, Oralce, Santa Clara, USA, e-mail: oleg.pliss@gmail.com

Method reachability analysis during Java program romization is considered. Eager class initialization is one of the romization optimizations. Class initialization in Java involve execution of class initializers. Execution of class initializers may create objects which affect methods reachability. Standard analysis algorithms don't take these objects into account. We propose method reachability analysis algorithm which selectively initializes classes and takes objects created by class initializers into consideration.

This algorithm is based on Rapid Type Analysis (RTA) algorithm. RTA algorithm keeps track of classes which could be instantiated by reachable methods. Instantiable classes set is used to determine which methods could be invoked by virtual and interface calls. The proposed algorithm also keeps track of classes which could be initialized by reachable methods. Not all of these classes could be initialized at romization stage. Eager initialization of some classes may affect application behavior. Simple euristic is used to choose safe to initialize classses.

All the objects which remain reachable after class initialization considered reachable for the application. These objects could be used for virtual and interface calls. Therefore classes of reachable objects are included to the set of instantiable classes.

Keywords: Java, virtual machine, romization, class initialization, method reachability analysis, indirect invocations
pp. 3–8