1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/opto/live.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,90 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_OPTO_LIVE_HPP 1.29 +#define SHARE_VM_OPTO_LIVE_HPP 1.30 + 1.31 +#include "libadt/port.hpp" 1.32 +#include "libadt/vectset.hpp" 1.33 +#include "opto/block.hpp" 1.34 +#include "opto/indexSet.hpp" 1.35 +#include "opto/phase.hpp" 1.36 +#include "opto/regmask.hpp" 1.37 + 1.38 +class Block; 1.39 +class PhaseCFG; 1.40 +class VectorSet; 1.41 +class IndexSet; 1.42 + 1.43 +//------------------------------LRG_List--------------------------------------- 1.44 +// Map Node indices to Live RanGe indices. 1.45 +// Array lookup in the optimized case. 1.46 +typedef GrowableArray<uint> LRG_List; 1.47 + 1.48 +//------------------------------PhaseLive-------------------------------------- 1.49 +// Compute live-in/live-out 1.50 +class PhaseLive : public Phase { 1.51 + // Array of Sets of values live at the start of a block. 1.52 + // Indexed by block pre-order number. 1.53 + IndexSet *_live; 1.54 + 1.55 + // Array of Sets of values defined locally in the block 1.56 + // Indexed by block pre-order number. 1.57 + IndexSet *_defs; 1.58 + 1.59 + // Array of delta-set pointers, indexed by block pre-order number 1.60 + IndexSet **_deltas; 1.61 + IndexSet *_free_IndexSet; // Free list of same 1.62 + 1.63 + Block_List *_worklist; // Worklist for iterative solution 1.64 + 1.65 + const PhaseCFG &_cfg; // Basic blocks 1.66 + const LRG_List &_names; // Mapping from Nodes to live ranges 1.67 + uint _maxlrg; // Largest live-range number 1.68 + Arena *_arena; 1.69 + 1.70 + IndexSet *getset( Block *p ); 1.71 + IndexSet *getfreeset( ); 1.72 + void freeset( const Block *p ); 1.73 + void add_liveout( Block *p, uint r, VectorSet &first_pass ); 1.74 + void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass ); 1.75 + 1.76 +public: 1.77 + PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena); 1.78 + ~PhaseLive() {} 1.79 + // Compute liveness info 1.80 + void compute(uint maxlrg); 1.81 + // Reset arena storage 1.82 + void reset() { _live = NULL; } 1.83 + 1.84 + // Return the live-out set for this block 1.85 + IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; } 1.86 + 1.87 +#ifndef PRODUCT 1.88 + void dump( const Block *b ) const; 1.89 + void stats(uint iters) const; 1.90 +#endif 1.91 +}; 1.92 + 1.93 +#endif // SHARE_VM_OPTO_LIVE_HPP