src/share/vm/opto/block.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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 // Optimization - Graph Style
  26 
  27 class Block;
  28 class CFGLoop;
  29 class MachCallNode;
  30 class Matcher;
  31 class RootNode;
  32 class VectorSet;
  33 struct Tarjan;
  34 
  35 //------------------------------Block_Array------------------------------------
  36 // Map dense integer indices to Blocks.  Uses classic doubling-array trick.
  37 // Abstractly provides an infinite array of Block*'s, initialized to NULL.
  38 // Note that the constructor just zeros things, and since I use Arena
  39 // allocation I do not need a destructor to reclaim storage.
  40 class Block_Array : public ResourceObj {
  41   uint _size;                   // allocated size, as opposed to formal limit
  42   debug_only(uint _limit;)      // limit to formal domain
  43 protected:
  44   Block **_blocks;


 699 
 700   GrowableArray<CFGEdge *> *edges;
 701   Trace **traces;
 702   Block **next;
 703   Block **prev;
 704   UnionFind *uf;
 705 
 706   // Given a block, find its encompassing Trace
 707   Trace * trace(Block *b) {
 708     return traces[uf->Find_compress(b->_pre_order)];
 709   }
 710  public:
 711   PhaseBlockLayout(PhaseCFG &cfg);
 712 
 713   void find_edges();
 714   void grow_traces();
 715   void merge_traces(bool loose_connections);
 716   void reorder_traces(int count);
 717   void union_traces(Trace* from, Trace* to);
 718 };


   1 /*
   2  * Copyright (c) 1997, 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_OPTO_BLOCK_HPP
  26 #define SHARE_VM_OPTO_BLOCK_HPP
  27 
  28 #include "opto/multnode.hpp"
  29 #include "opto/node.hpp"
  30 #include "opto/phase.hpp"
  31 
  32 // Optimization - Graph Style
  33 
  34 class Block;
  35 class CFGLoop;
  36 class MachCallNode;
  37 class Matcher;
  38 class RootNode;
  39 class VectorSet;
  40 struct Tarjan;
  41 
  42 //------------------------------Block_Array------------------------------------
  43 // Map dense integer indices to Blocks.  Uses classic doubling-array trick.
  44 // Abstractly provides an infinite array of Block*'s, initialized to NULL.
  45 // Note that the constructor just zeros things, and since I use Arena
  46 // allocation I do not need a destructor to reclaim storage.
  47 class Block_Array : public ResourceObj {
  48   uint _size;                   // allocated size, as opposed to formal limit
  49   debug_only(uint _limit;)      // limit to formal domain
  50 protected:
  51   Block **_blocks;


 706 
 707   GrowableArray<CFGEdge *> *edges;
 708   Trace **traces;
 709   Block **next;
 710   Block **prev;
 711   UnionFind *uf;
 712 
 713   // Given a block, find its encompassing Trace
 714   Trace * trace(Block *b) {
 715     return traces[uf->Find_compress(b->_pre_order)];
 716   }
 717  public:
 718   PhaseBlockLayout(PhaseCFG &cfg);
 719 
 720   void find_edges();
 721   void grow_traces();
 722   void merge_traces(bool loose_connections);
 723   void reorder_traces(int count);
 724   void union_traces(Trace* from, Trace* to);
 725 };
 726 
 727 #endif // SHARE_VM_OPTO_BLOCK_HPP