< prev index next >

src/hotspot/share/opto/block.cpp

Print this page

  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "libadt/vectset.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "compiler/compilerDirectives.hpp"
  29 #include "opto/block.hpp"
  30 #include "opto/cfgnode.hpp"
  31 #include "opto/chaitin.hpp"
  32 #include "opto/loopnode.hpp"
  33 #include "opto/machnode.hpp"
  34 #include "opto/matcher.hpp"
  35 #include "opto/opcodes.hpp"
  36 #include "opto/rootnode.hpp"
  37 #include "utilities/copy.hpp"
  38 #include "utilities/powerOfTwo.hpp"
  39 
  40 void Block_Array::grow( uint i ) {
  41   _nesting.check(_arena); // Check if a potential reallocation in the arena is safe
  42   if (i < Max()) {
  43     return; // No need to grow
  44   }
  45   DEBUG_ONLY(_limit = i+1);
  46   if( i < _size )  return;
  47   if( !_size ) {
  48     _size = 1;
  49     _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) );
  50     _blocks[0] = nullptr;
  51   }
  52   uint old = _size;
  53   _size = next_power_of_2(i);
  54   _blocks = (Block**)_arena->Arealloc( _blocks, old*sizeof(Block*),_size*sizeof(Block*));
  55   Copy::zero_to_bytes( &_blocks[old], (_size-old)*sizeof(Block*) );
  56 }
  57 
  58 void Block_List::remove(uint i) {
  59   assert(i < _cnt, "index out of bounds");
  60   Copy::conjoint_words_to_lower((HeapWord*)&_blocks[i+1], (HeapWord*)&_blocks[i], ((_cnt-i-1)*sizeof(Block*)));
  61   pop(); // shrink list by one block
  62 }
  63 
  64 void Block_List::insert(uint i, Block *b) {

  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "libadt/vectset.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "compiler/compilerDirectives.hpp"
  29 #include "opto/block.hpp"
  30 #include "opto/cfgnode.hpp"
  31 #include "opto/chaitin.hpp"
  32 #include "opto/loopnode.hpp"
  33 #include "opto/machnode.hpp"
  34 #include "opto/matcher.hpp"
  35 #include "opto/opcodes.hpp"
  36 #include "opto/rootnode.hpp"
  37 #include "utilities/copy.hpp"
  38 #include "utilities/powerOfTwo.hpp"
  39 
  40 void Block_Array::grow(uint i) {
  41   assert(i >= Max(), "Should have been checked before, use maybe_grow?");



  42   DEBUG_ONLY(_limit = i+1);
  43   if( i < _size )  return;
  44   if( !_size ) {
  45     _size = 1;
  46     _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) );
  47     _blocks[0] = nullptr;
  48   }
  49   uint old = _size;
  50   _size = next_power_of_2(i);
  51   _blocks = (Block**)_arena->Arealloc( _blocks, old*sizeof(Block*),_size*sizeof(Block*));
  52   Copy::zero_to_bytes( &_blocks[old], (_size-old)*sizeof(Block*) );
  53 }
  54 
  55 void Block_List::remove(uint i) {
  56   assert(i < _cnt, "index out of bounds");
  57   Copy::conjoint_words_to_lower((HeapWord*)&_blocks[i+1], (HeapWord*)&_blocks[i], ((_cnt-i-1)*sizeof(Block*)));
  58   pop(); // shrink list by one block
  59 }
  60 
  61 void Block_List::insert(uint i, Block *b) {
< prev index next >