src/share/vm/opto/live.hpp

Tue, 16 Apr 2013 10:08:41 +0200

author
neliasso
date
Tue, 16 Apr 2013 10:08:41 +0200
changeset 4949
8373c19be854
parent 4728
056ab43544a4
child 5722
8c83625e3a53
permissions
-rw-r--r--

8011621: live_ranges_in_separate_class.patch
Reviewed-by: kvn, roland
Contributed-by: niclas.adlertz@oracle.com

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_OPTO_LIVE_HPP
stefank@2314 26 #define SHARE_VM_OPTO_LIVE_HPP
stefank@2314 27
stefank@2314 28 #include "libadt/port.hpp"
stefank@2314 29 #include "libadt/vectset.hpp"
stefank@2314 30 #include "opto/block.hpp"
stefank@2314 31 #include "opto/indexSet.hpp"
stefank@2314 32 #include "opto/phase.hpp"
stefank@2314 33 #include "opto/regmask.hpp"
stefank@2314 34
duke@435 35 class Block;
duke@435 36 class PhaseCFG;
duke@435 37 class VectorSet;
duke@435 38 class IndexSet;
duke@435 39
neliasso@4728 40 //------------------------------LRG_List---------------------------------------
neliasso@4728 41 // Map Node indices to Live RanGe indices.
neliasso@4728 42 // Array lookup in the optimized case.
neliasso@4728 43 class LRG_List : public ResourceObj {
neliasso@4728 44 friend class VMStructs;
neliasso@4728 45 uint _cnt, _max;
neliasso@4728 46 uint* _lidxs;
neliasso@4728 47 ReallocMark _nesting; // assertion check for reallocations
neliasso@4728 48 public:
neliasso@4728 49 LRG_List( uint max );
neliasso@4728 50
neliasso@4728 51 uint lookup( uint nidx ) const {
neliasso@4728 52 return _lidxs[nidx];
neliasso@4728 53 }
neliasso@4728 54 uint operator[] (uint nidx) const { return lookup(nidx); }
neliasso@4728 55
neliasso@4728 56 void map( uint nidx, uint lidx ) {
neliasso@4728 57 assert( nidx < _cnt, "oob" );
neliasso@4728 58 _lidxs[nidx] = lidx;
neliasso@4728 59 }
neliasso@4728 60 void extend( uint nidx, uint lidx );
neliasso@4728 61
neliasso@4728 62 uint Size() const { return _cnt; }
neliasso@4728 63 };
neliasso@4728 64
duke@435 65 //------------------------------PhaseLive--------------------------------------
duke@435 66 // Compute live-in/live-out
duke@435 67 class PhaseLive : public Phase {
duke@435 68 // Array of Sets of values live at the start of a block.
duke@435 69 // Indexed by block pre-order number.
duke@435 70 IndexSet *_live;
duke@435 71
duke@435 72 // Array of Sets of values defined locally in the block
duke@435 73 // Indexed by block pre-order number.
duke@435 74 IndexSet *_defs;
duke@435 75
duke@435 76 // Array of delta-set pointers, indexed by block pre-order number
duke@435 77 IndexSet **_deltas;
duke@435 78 IndexSet *_free_IndexSet; // Free list of same
duke@435 79
duke@435 80 Block_List *_worklist; // Worklist for iterative solution
duke@435 81
duke@435 82 const PhaseCFG &_cfg; // Basic blocks
neliasso@4949 83 const LRG_List &_names; // Mapping from Nodes to live ranges
duke@435 84 uint _maxlrg; // Largest live-range number
duke@435 85 Arena *_arena;
duke@435 86
duke@435 87 IndexSet *getset( Block *p );
duke@435 88 IndexSet *getfreeset( );
duke@435 89 void freeset( const Block *p );
duke@435 90 void add_liveout( Block *p, uint r, VectorSet &first_pass );
duke@435 91 void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass );
duke@435 92
duke@435 93 public:
neliasso@4949 94 PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena);
duke@435 95 ~PhaseLive() {}
duke@435 96 // Compute liveness info
duke@435 97 void compute(uint maxlrg);
duke@435 98 // Reset arena storage
duke@435 99 void reset() { _live = NULL; }
duke@435 100
duke@435 101 // Return the live-out set for this block
duke@435 102 IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; }
duke@435 103
duke@435 104 #ifndef PRODUCT
duke@435 105 void dump( const Block *b ) const;
duke@435 106 void stats(uint iters) const;
duke@435 107 #endif
duke@435 108 };
stefank@2314 109
stefank@2314 110 #endif // SHARE_VM_OPTO_LIVE_HPP

mercurial