< prev index next >

hotspot/src/share/vm/c1/c1_LinearScan.cpp

Print this page
rev 10451 : imported patch s/find_from_end/find/g

@@ -493,12 +493,12 @@
   for (i = 0; i < num_blocks; i++) {
     num_instructions += block_at(i)->lir()->instructions_list()->length();
   }
 
   // initialize with correct length
-  _lir_ops = LIR_OpArray(num_instructions);
-  _block_of_op = BlockBeginArray(num_instructions);
+  _lir_ops = LIR_OpArray(num_instructions, num_instructions, NULL);
+  _block_of_op = BlockBeginArray(num_instructions, num_instructions, NULL);
 
   int op_id = 0;
   int idx = 0;
 
   for (i = 0; i < num_blocks; i++) {

@@ -2504,11 +2504,12 @@
 LocationValue*         _illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
 
 void LinearScan::init_compute_debug_info() {
   // cache for frequently used scope values
   // (cpu registers and stack slots)
-  _scope_value_cache = ScopeValueArray((LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2, NULL);
+  int cache_size = (LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2;
+  _scope_value_cache = ScopeValueArray(cache_size, cache_size, NULL);
 }
 
 MonitorValue* LinearScan::location_for_monitor_index(int monitor_index) {
   Location loc;
   if (!frame_map()->location_for_monitor_object(monitor_index, &loc)) {

@@ -3039,11 +3040,11 @@
           instructions->at_put(insert_point, op);
         }
         insert_point++;
       }
     }
-    instructions->truncate(insert_point);
+    instructions->trunc_to(insert_point);
   }
 }
 
 void LinearScan::assign_reg_num() {
   TIME_LINEAR_SCAN(timer_assign_reg_num);

@@ -3443,11 +3444,11 @@
 
  public:
   RegisterVerifier(LinearScan* allocator)
     : _allocator(allocator)
     , _work_list(16)
-    , _saved_states(BlockBegin::number_of_blocks(), NULL)
+    , _saved_states(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL)
   { }
 
   void verify(BlockBegin* start);
 };
 

@@ -4449,11 +4450,11 @@
   int i;
   for (i = start_idx + 2; i < total_len; i++) {
     new_use_pos_and_kinds.append(_use_pos_and_kinds.at(i));
   }
 
-  _use_pos_and_kinds.truncate(start_idx + 2);
+  _use_pos_and_kinds.trunc_to(start_idx + 2);
   result->_use_pos_and_kinds = _use_pos_and_kinds;
   _use_pos_and_kinds = new_use_pos_and_kinds;
 
 #ifdef ASSERT
   assert(_use_pos_and_kinds.length() % 2 == 0, "must have use kind for each use pos");

@@ -5537,11 +5538,11 @@
 
   if (regHi != any_reg) {
     IntervalList* processed = _spill_intervals[reg];
     for (int i = 0; i < _spill_intervals[regHi]->length(); i++) {
       Interval* it = _spill_intervals[regHi]->at(i);
-      if (processed->find_from_end(it) == -1) {
+      if (processed->find(it) == -1) {
         remove_from_list(it);
         split_and_spill_interval(it);
       }
     }
   }

@@ -6208,11 +6209,11 @@
       // predecessor list is necessary
       int j;
       _original_preds.clear();
       for (j = block->number_of_preds() - 1; j >= 0; j--) {
         BlockBegin* pred = block->pred_at(j);
-        if (_original_preds.index_of(pred) == -1) {
+        if (_original_preds.find(pred) == -1) {
           _original_preds.append(pred);
         }
       }
 
       for (j = _original_preds.length() - 1; j >= 0; j--) {

@@ -6228,11 +6229,11 @@
       }
       new_pos++;
     }
     old_pos++;
   }
-  code->truncate(new_pos);
+  code->trunc_to(new_pos);
 
   DEBUG_ONLY(verify(code));
 }
 
 void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {

@@ -6253,11 +6254,11 @@
         if (last_branch->block() == code->at(i + 1)) {
 
           TRACE_LINEAR_SCAN(3, tty->print_cr("Deleting unconditional branch at end of block B%d", block->block_id()));
 
           // delete last branch instruction
-          instructions->truncate(instructions->length() - 1);
+          instructions->trunc_to(instructions->length() - 1);
 
         } else {
           LIR_Op* prev_op = instructions->at(instructions->length() - 2);
           if (prev_op->code() == lir_branch || prev_op->code() == lir_cond_float_branch) {
             assert(prev_op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch");

@@ -6292,11 +6293,11 @@
 
                 // eliminate a conditional branch to the immediate successor
                 prev_branch->change_block(last_branch->block());
                 prev_branch->negate_cond();
                 prev_cmp->set_condition(prev_branch->cond());
-                instructions->truncate(instructions->length() - 1);
+                instructions->trunc_to(instructions->length() - 1);
                 // if we do change the condition, we have to change the cmove as well
                 if (prev_cmove != NULL) {
                   prev_cmove->set_condition(prev_branch->cond());
                   LIR_Opr t = prev_cmove->in_opr1();
                   prev_cmove->set_in_opr1(prev_cmove->in_opr2());

@@ -6375,23 +6376,23 @@
     int j;
     for (j = 0; j < instructions->length(); j++) {
       LIR_OpBranch* op_branch = instructions->at(j)->as_OpBranch();
 
       if (op_branch != NULL) {
-        assert(op_branch->block() == NULL || code->index_of(op_branch->block()) != -1, "branch target not valid");
-        assert(op_branch->ublock() == NULL || code->index_of(op_branch->ublock()) != -1, "branch target not valid");
+        assert(op_branch->block() == NULL || code->find(op_branch->block()) != -1, "branch target not valid");
+        assert(op_branch->ublock() == NULL || code->find(op_branch->ublock()) != -1, "branch target not valid");
       }
     }
 
     for (j = 0; j < block->number_of_sux() - 1; j++) {
       BlockBegin* sux = block->sux_at(j);
-      assert(code->index_of(sux) != -1, "successor not valid");
+      assert(code->find(sux) != -1, "successor not valid");
     }
 
     for (j = 0; j < block->number_of_preds() - 1; j++) {
       BlockBegin* pred = block->pred_at(j);
-      assert(code->index_of(pred) != -1, "successor not valid");
+      assert(code->find(pred) != -1, "successor not valid");
     }
   }
 }
 #endif
 
< prev index next >