hotspot/src/share/vm/opto/live.hpp
author adlertz
Thu, 12 Sep 2013 23:13:45 +0200
changeset 20007 b67e71448544
parent 17013 22a05c7f3314
child 22234 da823d78ad65
permissions -rw-r--r--
8024646: Remove LRG_List container, replace it with GrowableArray Summary: We already have GrowableArray, use it instead of LRG_List Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OPTO_LIVE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OPTO_LIVE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "libadt/port.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "libadt/vectset.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/block.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "opto/indexSet.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "opto/phase.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "opto/regmask.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class Block;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class PhaseCFG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class VectorSet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class IndexSet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
15944
095248beb690 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 7397
diff changeset
    40
//------------------------------LRG_List---------------------------------------
095248beb690 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 7397
diff changeset
    41
// Map Node indices to Live RanGe indices.
095248beb690 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 7397
diff changeset
    42
// Array lookup in the optimized case.
20007
b67e71448544 8024646: Remove LRG_List container, replace it with GrowableArray
adlertz
parents: 17013
diff changeset
    43
typedef GrowableArray<uint> LRG_List;
15944
095248beb690 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 7397
diff changeset
    44
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//------------------------------PhaseLive--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// Compute live-in/live-out
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class PhaseLive : public Phase {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  // Array of Sets of values live at the start of a block.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  // Indexed by block pre-order number.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  IndexSet *_live;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // Array of Sets of values defined locally in the block
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  // Indexed by block pre-order number.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  IndexSet *_defs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // Array of delta-set pointers, indexed by block pre-order number
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  IndexSet **_deltas;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  IndexSet *_free_IndexSet;     // Free list of same
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  Block_List *_worklist;        // Worklist for iterative solution
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  const PhaseCFG &_cfg;         // Basic blocks
17013
22a05c7f3314 8011621: live_ranges_in_separate_class.patch
neliasso
parents: 15944
diff changeset
    63
  const LRG_List &_names;       // Mapping from Nodes to live ranges
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  uint _maxlrg;                 // Largest live-range number
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  Arena *_arena;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  IndexSet *getset( Block *p );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  IndexSet *getfreeset( );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  void freeset( const Block *p );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  void add_liveout( Block *p, uint r, VectorSet &first_pass );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
public:
17013
22a05c7f3314 8011621: live_ranges_in_separate_class.patch
neliasso
parents: 15944
diff changeset
    74
  PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ~PhaseLive() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  // Compute liveness info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  void compute(uint maxlrg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // Reset arena storage
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  void reset() { _live = NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // Return the live-out set for this block
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  void dump( const Block *b ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  void stats(uint iters) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    89
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    90
#endif // SHARE_VM_OPTO_LIVE_HPP