src/share/vm/opto/indexSet.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/indexSet.cpp

Print this page




  34 // during register allocation.  It also defines an iterator for this class.
  35 
  36 //-------------------------------- Initializations ------------------------------
  37 
  38 IndexSet::BitBlock  IndexSet::_empty_block     = IndexSet::BitBlock();
  39 
  40 #ifdef ASSERT
  41 // Initialize statistics counters
  42 julong IndexSet::_alloc_new = 0;
  43 julong IndexSet::_alloc_total = 0;
  44 
  45 julong IndexSet::_total_bits = 0;
  46 julong IndexSet::_total_used_blocks = 0;
  47 julong IndexSet::_total_unused_blocks = 0;
  48 
  49 // Per set, or all sets operation tracing
  50 int IndexSet::_serial_count = 1;
  51 #endif
  52 
  53 // What is the first set bit in a 5 bit integer?
  54 const byte IndexSetIterator::_first_bit[32] = {
  55   0, 0, 1, 0,
  56   2, 0, 1, 0,
  57   3, 0, 1, 0,
  58   2, 0, 1, 0,
  59   4, 0, 1, 0,
  60   2, 0, 1, 0,
  61   3, 0, 1, 0,
  62   2, 0, 1, 0
  63 };
  64 
  65 // What is the second set bit in a 5 bit integer?
  66 const byte IndexSetIterator::_second_bit[32] = {
  67   5, 5, 5, 1,
  68   5, 2, 2, 1,
  69   5, 3, 3, 1,
  70   3, 2, 2, 1,
  71   5, 4, 4, 1,
  72   4, 2, 2, 1,
  73   4, 3, 3, 1,
  74   3, 2, 2, 1
  75 };
  76 
  77 // I tried implementing the IndexSetIterator with a window_size of 8 and
  78 // didn't seem to get a noticeable speedup.  I am leaving in the tables
  79 // in case we want to switch back.
  80 
  81 /*const byte IndexSetIterator::_first_bit[256] = {
  82   8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  83   4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  84   5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  85   4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  86   6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,


 281 #ifdef ASSERT
 282   _serial_number = _serial_count++;
 283   set->check_watch("copied", _serial_number);
 284   check_watch("initialized by copy", set->_serial_number);
 285   _max_elements = set->_max_elements;
 286 #endif
 287   _count = set->_count;
 288   _max_blocks = set->_max_blocks;
 289   if (_max_blocks <= preallocated_block_list_size) {
 290     _blocks = _preallocated_block_list;
 291   } else {
 292     _blocks =
 293       (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks);
 294   }
 295   for (uint i = 0; i < _max_blocks; i++) {
 296     BitBlock *block = set->_blocks[i];
 297     if (block == &_empty_block) {
 298       set_block(i, &_empty_block);
 299     } else {
 300       BitBlock *new_block = alloc_block();
 301       memcpy(new_block->words(), block->words(), sizeof(uint32) * words_per_block);
 302       set_block(i, new_block);
 303     }
 304   }
 305 }
 306 
 307 //---------------------------- IndexSet::initialize() -----------------------------
 308 // Prepare an IndexSet for use.
 309 
 310 void IndexSet::initialize(uint max_elements) {
 311 #ifdef ASSERT
 312   _serial_number = _serial_count++;
 313   check_watch("initialized", max_elements);
 314   _max_elements = max_elements;
 315 #endif
 316   _count = 0;
 317   _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block;
 318 
 319   if (_max_blocks <= preallocated_block_list_size) {
 320     _blocks = _preallocated_block_list;
 321   } else {




  34 // during register allocation.  It also defines an iterator for this class.
  35 
  36 //-------------------------------- Initializations ------------------------------
  37 
  38 IndexSet::BitBlock  IndexSet::_empty_block     = IndexSet::BitBlock();
  39 
  40 #ifdef ASSERT
  41 // Initialize statistics counters
  42 julong IndexSet::_alloc_new = 0;
  43 julong IndexSet::_alloc_total = 0;
  44 
  45 julong IndexSet::_total_bits = 0;
  46 julong IndexSet::_total_used_blocks = 0;
  47 julong IndexSet::_total_unused_blocks = 0;
  48 
  49 // Per set, or all sets operation tracing
  50 int IndexSet::_serial_count = 1;
  51 #endif
  52 
  53 // What is the first set bit in a 5 bit integer?
  54 const uint8_t IndexSetIterator::_first_bit[32] = {
  55   0, 0, 1, 0,
  56   2, 0, 1, 0,
  57   3, 0, 1, 0,
  58   2, 0, 1, 0,
  59   4, 0, 1, 0,
  60   2, 0, 1, 0,
  61   3, 0, 1, 0,
  62   2, 0, 1, 0
  63 };
  64 
  65 // What is the second set bit in a 5 bit integer?
  66 const uint8_t IndexSetIterator::_second_bit[32] = {
  67   5, 5, 5, 1,
  68   5, 2, 2, 1,
  69   5, 3, 3, 1,
  70   3, 2, 2, 1,
  71   5, 4, 4, 1,
  72   4, 2, 2, 1,
  73   4, 3, 3, 1,
  74   3, 2, 2, 1
  75 };
  76 
  77 // I tried implementing the IndexSetIterator with a window_size of 8 and
  78 // didn't seem to get a noticeable speedup.  I am leaving in the tables
  79 // in case we want to switch back.
  80 
  81 /*const byte IndexSetIterator::_first_bit[256] = {
  82   8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  83   4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  84   5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  85   4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  86   6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,


 281 #ifdef ASSERT
 282   _serial_number = _serial_count++;
 283   set->check_watch("copied", _serial_number);
 284   check_watch("initialized by copy", set->_serial_number);
 285   _max_elements = set->_max_elements;
 286 #endif
 287   _count = set->_count;
 288   _max_blocks = set->_max_blocks;
 289   if (_max_blocks <= preallocated_block_list_size) {
 290     _blocks = _preallocated_block_list;
 291   } else {
 292     _blocks =
 293       (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks);
 294   }
 295   for (uint i = 0; i < _max_blocks; i++) {
 296     BitBlock *block = set->_blocks[i];
 297     if (block == &_empty_block) {
 298       set_block(i, &_empty_block);
 299     } else {
 300       BitBlock *new_block = alloc_block();
 301       memcpy(new_block->words(), block->words(), sizeof(uint32_t) * words_per_block);
 302       set_block(i, new_block);
 303     }
 304   }
 305 }
 306 
 307 //---------------------------- IndexSet::initialize() -----------------------------
 308 // Prepare an IndexSet for use.
 309 
 310 void IndexSet::initialize(uint max_elements) {
 311 #ifdef ASSERT
 312   _serial_number = _serial_count++;
 313   check_watch("initialized", max_elements);
 314   _max_elements = max_elements;
 315 #endif
 316   _count = 0;
 317   _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block;
 318 
 319   if (_max_blocks <= preallocated_block_list_size) {
 320     _blocks = _preallocated_block_list;
 321   } else {


src/share/vm/opto/indexSet.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File