SSA-Form-Based Register Allocation for the Java HotSpotTM Server Compiler

نویسندگان

  • M. A. Auslander
  • B. K. Rosen
چکیده

Register allocation, i.e., the task of assigning processor registers to local variables and temporary values, is one of the most important compiler optimizations. A vast amount of research has led to algorithms ranging from simple and fast heuristics to optimal algorithms with exponential time complexity. Because the problem is known to be NP-complete [2], algorithms must balance the time necessary for allocation against the resulting code quality. Two common algorithms in modern compilers are graph coloring (see for example [1, 2]), which is suitable when compilation time is not a major concern, and linear scan [6, 8, 10], which is faster and therefore frequently used for just-in-time compilers where compilation time adds to run time. Static single assignment (SSA) form [3] is a type of intermediate representation that simplifies many compiler optimizations. All variables have only a single point of definition. At control flow joins, phi functions are used to merge different variables of the predecessor blocks. Because processors cannot execute phi functions, it is necessary to replace them with move instructions during code generation (SSA form deconstruction). Traditionally, SSA form deconstruction was performed before register allocation. Only recently has it been observed that register allocation on SSA form has several advantages due to additional guarantees on variable lifetime. Lifetime information is essential for register allocation because two variables that interfere, i.e., that are live at the same time, must not have the same register assigned. The interference graph of a program in SSA form is chordal (every cycle with four or more edges has an edge connecting two vertices of the cycle, leading to a triangulated structure). Many graph algorithms are simpler on chordal graphs, e.g., graph coloring can be performed in polynomial time. These properties were used to simplify register allocators based on graph coloring [4]. When the maximum register pressure is below or equal to the number of available registers, allocation is guaranteed to succeed. This allows to split the algorithms for spilling and register assignment. Traditionally, spilling and register assignment were interleaved, i.e., a variable was spilled when the graph turned out to be not colorable. This led to a time-consuming repeated execution of the graph coloring algorithm. Recent research at the University of California, Irvine, also applied the benefits of SSA Form on linear scan register allocation [9]. The lifetime intervals, which are the basic data structure of the algorithm, are easier to construct and have a simpler structure. Additionally, infrastructure already present in the linear scan algorithm can be used to perform SSA form deconstruction after register allocation, thus making a separate SSA form deconstruction algorithm unnecessary. When comparing graph coloring and linear scan register allocation on SSA form, it turns out the two algorithms are not so different than they look at the first glance. The simplifications allowed by SSA form eliminate parts that were previously handled differently. Therefore, the next research step is to analyze the cases where the two algorithms are equivalent (e.g., register allocation without spilling is very similar), and find cases where the algorithms still differ (e.g., selecting variables to be spilled). Finally, both algorithms should be merged to one algorithm that covers graph coloring and linear scan as special cases, but also allows a gradual “sliding” between them, i.e., it should be configurable to what extent graph coloring and linear scan are used.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

SSA Elimination after Register Allocation

The SSA-form uses a notational abstractions called φ-functions. These instructions have no analogous in actual machine instruction sets, and they must be replaced by ordinary instructions at some point of the compilation path. This process is called SSA elimination. Compilers usually performs SSA elimination before register allocation. But the order could as well be the opposite: our puzzle bas...

متن کامل

Register allocation for programs in SSA form

As register allocation is one of the most important phases in optimizing compilers, much work has been done to improve its quality and speed. We present a novel register allocation architecture for programs in SSA-form which simplifies register allocation significantly. We investigate certain properties of SSA-programs and their interference graphs, showing that they belong to the class of chor...

متن کامل

Hardware compilation for high performance Java processors

High performance on Java applications running on server and desktop machines requires fast execution of Java bytecodes. Such performance can be achieved by Just-In-Time (JIT) compilers, which translate the stack-based bytecodes into register-based machine code on demand. But one crucial problem in Java JIT compilation is the compilation time, which increases the total execution time of an appli...

متن کامل

Visualization of Program Dependence Graphs

The Java HotSpotTM server compiler of Sun Microsystems uses intermediate graph data structures when compiling Java bytecodes to machine code. The graphs are program dependence graphs, which model both data and control dependencies. For debugging, there are built-in tracing mechanisms that output a textual representation of the graphs to the command line. This thesis presents a tool which displa...

متن کامل

The Swift Java Compiler: Design and Implementation

We have designed and implemented an optimizing Java compiler called Swift for the Alpha architecture. Swift translates Java bytecodes to optimized Alpha code, and uses static single assignment (SSA) form for its intermediate representation (IR). The Swift IR is relatively simple, but allows for straightforward implementation of all the standard scalar optimizations. The Swift compiler also impl...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2010