15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "ci/ciMethod.hpp" 27 #include "ci/ciMethodBlocks.hpp" 28 #include "ci/ciStreams.hpp" 29 #include "compiler/methodLiveness.hpp" 30 #include "interpreter/bytecode.hpp" 31 #include "interpreter/bytecodes.hpp" 32 #include "memory/allocation.inline.hpp" 33 #include "utilities/bitMap.inline.hpp" 34 35 // The MethodLiveness class performs a simple liveness analysis on a method 36 // in order to decide which locals are live (that is, will be used again) at 37 // a particular bytecode index (bci). 38 // 39 // The algorithm goes: 40 // 41 // 1. Break the method into a set of basic blocks. For each basic block we 42 // also keep track of its set of predecessors through normal control flow 43 // and predecessors through exceptional control flow. 44 // 45 // 2. For each basic block, compute two sets, gen (the set of values used before 46 // they are defined) and kill (the set of values defined before they are used) 47 // in the basic block. A basic block "needs" the locals in its gen set to 48 // perform its computation. A basic block "provides" values for the locals in 49 // its kill set, allowing a need from a successor to be ignored. 50 // 51 // 3. Liveness information (the set of locals which are needed) is pushed backwards through 52 // the program, from blocks to their predecessors. We compute and store liveness 53 // information for the normal/exceptional exit paths for each basic block. When 54 // this process reaches a fixed point, we are done. | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "ci/ciMethod.hpp" 27 #include "ci/ciMethodBlocks.hpp" 28 #include "ci/ciStreams.hpp" 29 #include "compiler/methodLiveness.hpp" 30 #include "interpreter/bytecode.hpp" 31 #include "interpreter/bytecodes.hpp" 32 #include "memory/allocation.inline.hpp" 33 #include "utilities/bitMap.inline.hpp" 34 35 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 36 37 // The MethodLiveness class performs a simple liveness analysis on a method 38 // in order to decide which locals are live (that is, will be used again) at 39 // a particular bytecode index (bci). 40 // 41 // The algorithm goes: 42 // 43 // 1. Break the method into a set of basic blocks. For each basic block we 44 // also keep track of its set of predecessors through normal control flow 45 // and predecessors through exceptional control flow. 46 // 47 // 2. For each basic block, compute two sets, gen (the set of values used before 48 // they are defined) and kill (the set of values defined before they are used) 49 // in the basic block. A basic block "needs" the locals in its gen set to 50 // perform its computation. A basic block "provides" values for the locals in 51 // its kill set, allowing a need from a successor to be ignored. 52 // 53 // 3. Liveness information (the set of locals which are needed) is pushed backwards through 54 // the program, from blocks to their predecessors. We compute and store liveness 55 // information for the normal/exceptional exit paths for each basic block. When 56 // this process reaches a fixed point, we are done. |