Partial Redundancy Elimination for Access Path Expressions

Partial Redundancy Elimination for Access Path Expressions

Purdue University Purdue e-Pubs Department of Computer Science Technical Reports Department of Computer Science 1998 Partial Redundancy Elimination for Access Path Expressions Antony L. Hosking Purdue University, [email protected] National Nystrom David Whitlock Quintin Cutts Amer Diwan Report Number: 98-044 Hosking, Antony L.; Nystrom, National; Whitlock, David; Cutts, Quintin; and Diwan, Amer, "Partial Redundancy Elimination for Access Path Expressions" (1998). Department of Computer Science Technical Reports. Paper 1431. https://docs.lib.purdue.edu/cstech/1431 This document has been made available through Purdue e-Pubs, a service of the Purdue University Libraries. Please contact [email protected] for additional information. PARTIAL REDUNDANCY ELIMINATION FOR ACCESS PATH EXPRESSIONS Antony Hosking Nathaniel Nystrom David Whitlock Quitin Culls AmerDiwan CSD TR #98-044 December 1998 lmemurionul Workshop 011 Aliasing ill Ohjecl-Oriemed Systems, Lisbon, Ponugal, June 1999 Partial Redundancy Elimination for Access Path Expressions Antony L. Hosking Nathaniel Nystrom David Whitlock Department ofComputer Sciences Purdue UniversiLY West Lafayette, IN 47907- [398, USA Quintin Cutts Amer Diwan Department ofComputing Science Department ofComputer Science University ofGlasgow Stanford University Glasgow Gl2 8QQ, Scotland Stanford, CA 94305-9030, USA Abstract which are often the source of large performance pcnal­ ties incurred in the memory subsystem. Pointer traversals pose significant overhead to the ex­ In this paper we evaluate an approach to elimina­ ecution of object-oriented programs, since every ac­ tion of common access expressions that combines par­ cess Lo an object's state requires a pointer dereference. tial redundancy elimination (PRE) [Morel and Rcnvoise Eliminating redundant pointer traversals reduces both instructions executed as well as redundant memory ac­ 1979] with type-based alias analysis (TBAA) lDhvan cesses to relieve pressure on the memory subsystem. We et al. 1998]. To explore the potential of this approach describe an approach to elimination of redundant access we have built an optimization framework for Java elass expressions that combines partial redundancy elimina­ files incorporating TBAA-based PRE for access expres­ tion (PRE) with type-based alias analysis (TBAA). To sions, and measured its impact on the performance of explore the potential of this approach we have imple­ several benchmark programs. An interesting aspect of mented an optimization framework for Java class files the optimizaLion framework is that it operates entirely as incorporating TBAA-ba~ed PRE overpointer acces~' ex­ a bytecode-to-bytccode translator, sourcing and target­ pressions. The framework is implemented as a classfile­ ing Java class files. Our experiments compare the ex­ Lo-classfile transformer; opLimized classes can then be ecution of optimized and unoptimized classes for sev­ run in any standard Java execution environment. Our eral SPARC-based execution environments: the inter­ experiments demonstrate improvements in the execu­ preted JOK reference virtual machinc, the Solaris 2.6 tion ofoptimized code for several Java benchmarks run­ ning in diverse execution environments: the standard virtual machine with ''just-in-time'' (ill) compilation, interpreted JOK virLual machine, a virtual machine us­ and native binaries compiled off-line ("way-ahead-of­ ing "just-in-time" compilation, and native binaries com­ time") to C and thence to native code using the Solaris piled off-line ("way-ahead-of-time"). We isolate the im­ C compiler. pact of access path PRE using TBAA, and demonstrate We have measured boLh the static and dynamic im­ that Java's requirement ofprecise exceptions can notice­ pact of bytecodc-Ievel PRE optimizat"lon for a seL of ably impact code-motion optimizations like PRE. Java benchmark applications, including static code size, bytecode execution counts, native-instruction execution counts, and elapsed time. The results demonstrate gen­ 1 Introduction eral improvement on all measures tor all execution en­ vironmenL~, although some benchmarks have degraded Pointer traversals pose significant overhead to the exe­ performance in certain environments. cution of object-oriented programs, since every access The remainder of thc paper is organized tls follows. to an object's state requires a pointer dereference. Ob­ Section 2 introduces the approach to elimination of jects can refer to other objects, fomling graph structures, redundant access path expressions ba~ed on partial­ and they can be modified, with such modifications vis­ redundancy elimination and type-based alias analysis. ible in future accesses. Just as common subexpressions Section 3 describes our implementation of the analysis often appear in numerical code, common access expres­ and optimization framework that supports transforma­ sions are likewise often encountered in object-oriented tion of Java cla~s files using TBAA-based PRE. Sec­ code. Where two such expressions redundantly com­ tion 4 describes ourexper"lmental methodology for eval­ pute the same value it is desirable to avoid repeated uation ofTBAA-based PRE for several Java benchmark computation of that value by caching the result of the applications. The experimental results are reponed and first computation in a temporary variable, and reusing interpreted in Section 5. We conclude with a discussion it from the temporary at the later occurrence of the ex­ of related work and speculate on directions for future pression. Eliminating redundant computations in this work. way certainly eliminates redundant CPU overhead. Per­ haps just as important for modern machinc architec­ tures, eliminating redundant access expressions also has the effect of eliminating redundant memory references, o 0 o a Table 1: Access expressions b b b b a+b H-a+b t<-a+b I Notation I Name I Variable accesscd I p.f Field access Field f of class in" ~/ ~/ stance [0 which p refers ~ ~ pi;] Array access Component with sub- o+b scripL ; of array Lo (a) Before PRE (b) After PRE which prefers Figure 1: PRE for arithmctie expressions 2 PRE for Access Expressions ble with array lype T[) if type S is a.~signable to type T. Interface types also yield rules on assignability: an Our analysis and optimization framework revolves interface type S is assignable to an interface type T only around PRE over object access expressions. We adopt if T is the same interface as S or a superinterfaee of S; slandanl terminology and notations uscd in the specifi­ a class type S is assignable to an interface type T if S cation of the Java programming language to frame the implements T. Finally, array types, interface types and analysis and optimization problem. class types are all assignablc to class type object. For our purposes we say that a type S is a subt)'pe of 2.1 Thrminology and notation a type T ifS is assignable to T. 1 We write SlIbtype~'(T) to denote all subtypes of type T, including T. Thus, The following definitions paraphrase the Java specifica­ an access path p can legally access variables of type Lion [Gosling et al. 1996J. An object in Java is eithcr a SlIbrypes(Type(p)). class i/lstance or an array. Reference values in Java are poillter~' to these objects, as well as the null reference. Both objects and arrays are created by expressions thaI 2.2 Partial redundancy elimination allocate and initializc storage for them. The operators Our approach to optimization of access expressions ·IS on references to objecLs arc field access, method invoca­ based on application of partiaf redullda/lC)' elimil/arioll tion, casts, type comparison (instanceof), equality (PRE) [Morel and Renvoise 1979]. To our knowledge operators and the conditional operator. There may be this is the first time PRE has been applied to access many references to the same object. Objects have muta­ paths. PRE is a powerful global optimization technique ble state, stored in the variablc fields of class instances Lhat subsumes the more standard common suhexpres­ or the variable elements of arrays. Two variables may sion elimination (CSE). PRE eliminates computations refer to the same object: the state of the object can be that are only partially redundant; that is, redundant only modified through the referencc stored in one variable on some, but not all, paths to somelaterrc-compulation. and then the altered state observed through the other. By inserting evaluations on those paths where the com­ Access expressiolls refer to the variables that comprise putation docs not occur, the later re-evaluation can be an objccl's state. Afield access expression refers to a eliminated and replaced instead with a use of the pre­ field of some elass instancc, while an array access ex­ computed value. This is illustrated in Figure 1. In Fig­ pressioll refers to a component ofan array. Table I sum­ ure l(a), both a and b are available along each palh marizes the Lwo kinds ofaccess expressions in Java. We to the merge point, where expression a + b is evalu" adopt the term access parh lLarus and Hilfinger 1988; ated. However, Lhis evaluation is partially redundant Diwan et al. 1998J to mean a non-empty sequence of since a+h is available on one path to the merge but not accesses. For example, the Java expression a.b[i].c is both. By hoisting the second evaluation of a + b into an access path. Without loss of generality, our nOLation the path where it was not originally available, as in Fig­ assumes that distinct fields within an object have differ­ ure I(b), a + b need only bc evaluated once along any ent names (Le., fields that override inherited fields of the path through the program, ralher Ihan twice as before. same name from superclasses are trivially renamed). Consider the Java access expression a.b[i].c, which A variable is a storage location and has an associated translates to Java bytecode of the form: type, someLimes called its compife-rime type. Given an access path p, then the compile-time lype of p, written aload a load local variable a T)'pe(p) , is simply the compile-time type of the variable getfield b load field b of a it accesses.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us