src/share/vm/compiler/methodLiveness.hpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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 class ciMethod;
  26 
  27 class MethodLivenessResult : public BitMap {
  28  private:
  29   bool _is_valid;
  30 
  31  public:
  32   MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits)
  33     : BitMap(map, size_in_bits)
  34     , _is_valid(false)
  35   {}
  36 
  37   MethodLivenessResult(idx_t size_in_bits)
  38     : BitMap(size_in_bits)
  39     , _is_valid(false)
  40   {}
  41 
  42   void set_is_valid() { _is_valid = true; }
  43   bool is_valid() { return _is_valid; }
  44 };


 252   static long _total_visits;
 253 
 254 #endif
 255 
 256  public:
 257   // Create a liveness analyzer for a method
 258   MethodLiveness(Arena* arena, ciMethod* method);
 259 
 260   // Compute liveness information for the method
 261   void compute_liveness();
 262 
 263   // Find out which locals are live at a specific bci.
 264   MethodLivenessResult get_liveness_at(int bci);
 265 
 266 #ifdef COMPILER1
 267   const BitMap get_bci_block_start() const { return _bci_block_start; }
 268 #endif // COMPILER1
 269 
 270   static void print_times() PRODUCT_RETURN;
 271 };


   1 /*
   2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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 #ifndef SHARE_VM_COMPILER_METHODLIVENESS_HPP
  26 #define SHARE_VM_COMPILER_METHODLIVENESS_HPP
  27 
  28 #include "utilities/bitMap.hpp"
  29 #include "utilities/growableArray.hpp"
  30 
  31 class ciMethod;
  32 
  33 class MethodLivenessResult : public BitMap {
  34  private:
  35   bool _is_valid;
  36 
  37  public:
  38   MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits)
  39     : BitMap(map, size_in_bits)
  40     , _is_valid(false)
  41   {}
  42 
  43   MethodLivenessResult(idx_t size_in_bits)
  44     : BitMap(size_in_bits)
  45     , _is_valid(false)
  46   {}
  47 
  48   void set_is_valid() { _is_valid = true; }
  49   bool is_valid() { return _is_valid; }
  50 };


 258   static long _total_visits;
 259 
 260 #endif
 261 
 262  public:
 263   // Create a liveness analyzer for a method
 264   MethodLiveness(Arena* arena, ciMethod* method);
 265 
 266   // Compute liveness information for the method
 267   void compute_liveness();
 268 
 269   // Find out which locals are live at a specific bci.
 270   MethodLivenessResult get_liveness_at(int bci);
 271 
 272 #ifdef COMPILER1
 273   const BitMap get_bci_block_start() const { return _bci_block_start; }
 274 #endif // COMPILER1
 275 
 276   static void print_times() PRODUCT_RETURN;
 277 };
 278 
 279 #endif // SHARE_VM_COMPILER_METHODLIVENESS_HPP