< prev index next >
src/share/vm/c1/c1_IR.cpp
Print this page
rev 10542 : imported patch c1_IR
rev 10549 : imported patch c1_Instruction_BBA
rev 10554 : imported patch s/find_from_end/find/g
rev 10555 : imported patch primitive arrays
rev 10556 : imported patch update dates
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -528,11 +528,11 @@
_num_loops(0),
_iterative_dominators(false),
_visited_blocks(_max_block_id),
_active_blocks(_max_block_id),
_dominator_blocks(_max_block_id),
- _forward_branches(_max_block_id, 0),
+ _forward_branches(_max_block_id, _max_block_id, 0),
_loop_end_blocks(8),
_work_list(8),
_linear_scan_order(NULL), // initialized later with correct size
_loop_map(0, 0), // initialized later with correct size
_compilation(c)
@@ -846,17 +846,17 @@
// When the number drops to zero, all forward branches were processed
if (dec_forward_branches(cur) != 0) {
return false;
}
- assert(_linear_scan_order->index_of(cur) == -1, "block already processed (block can be ready only once)");
- assert(_work_list.index_of(cur) == -1, "block already in work-list (block can be ready only once)");
+ assert(_linear_scan_order->find(cur) == -1, "block already processed (block can be ready only once)");
+ assert(_work_list.find(cur) == -1, "block already in work-list (block can be ready only once)");
return true;
}
void ComputeLinearScanOrder::sort_into_work_list(BlockBegin* cur) {
- assert(_work_list.index_of(cur) == -1, "block already in work list");
+ assert(_work_list.find(cur) == -1, "block already in work list");
int cur_weight = compute_weight(cur);
// the linear_scan_number is used to cache the weight of a block
cur->set_linear_scan_number(cur_weight);
@@ -888,11 +888,11 @@
#endif
}
void ComputeLinearScanOrder::append_block(BlockBegin* cur) {
TRACE_LINEAR_SCAN(3, tty->print_cr("appending block B%d (weight 0x%6x) to linear-scan order", cur->block_id(), cur->linear_scan_number()));
- assert(_linear_scan_order->index_of(cur) == -1, "cannot add the same block twice");
+ assert(_linear_scan_order->find(cur) == -1, "cannot add the same block twice");
// currently, the linear scan order and code emit order are equal.
// therefore the linear_scan_number and the weight of a block must also
// be equal.
cur->set_linear_scan_number(_linear_scan_order->length());
@@ -1113,17 +1113,17 @@
int i;
for (i = 0; i < _linear_scan_order->length(); i++) {
BlockBegin* cur = _linear_scan_order->at(i);
assert(cur->linear_scan_number() == i, "incorrect linear_scan_number");
- assert(cur->linear_scan_number() >= 0 && cur->linear_scan_number() == _linear_scan_order->index_of(cur), "incorrect linear_scan_number");
+ assert(cur->linear_scan_number() >= 0 && cur->linear_scan_number() == _linear_scan_order->find(cur), "incorrect linear_scan_number");
int j;
for (j = cur->number_of_sux() - 1; j >= 0; j--) {
BlockBegin* sux = cur->sux_at(j);
- assert(sux->linear_scan_number() >= 0 && sux->linear_scan_number() == _linear_scan_order->index_of(sux), "incorrect linear_scan_number");
+ assert(sux->linear_scan_number() >= 0 && sux->linear_scan_number() == _linear_scan_order->find(sux), "incorrect linear_scan_number");
if (!sux->is_set(BlockBegin::backward_branch_target_flag)) {
assert(cur->linear_scan_number() < sux->linear_scan_number(), "invalid order");
}
if (cur->loop_depth() == sux->loop_depth()) {
assert(cur->loop_index() == sux->loop_index() || sux->is_set(BlockBegin::linear_scan_loop_header_flag), "successing blocks with same loop depth must have same loop index");
@@ -1131,11 +1131,11 @@
}
for (j = cur->number_of_preds() - 1; j >= 0; j--) {
BlockBegin* pred = cur->pred_at(j);
- assert(pred->linear_scan_number() >= 0 && pred->linear_scan_number() == _linear_scan_order->index_of(pred), "incorrect linear_scan_number");
+ assert(pred->linear_scan_number() >= 0 && pred->linear_scan_number() == _linear_scan_order->find(pred), "incorrect linear_scan_number");
if (!cur->is_set(BlockBegin::backward_branch_target_flag)) {
assert(cur->linear_scan_number() > pred->linear_scan_number(), "invalid order");
}
if (cur->loop_depth() == pred->loop_depth()) {
assert(cur->loop_index() == pred->loop_index() || cur->is_set(BlockBegin::linear_scan_loop_header_flag), "successing blocks with same loop depth must have same loop index");
@@ -1253,12 +1253,11 @@
tty->print_cr("invalid IR");
}
}
-define_array(BlockListArray, BlockList*)
-define_stack(BlockListList, BlockListArray)
+typedef GrowableArray<BlockList*> BlockListList;
class PredecessorValidator : public BlockClosure {
private:
BlockListList* _predecessors;
BlockList* _blocks;
@@ -1268,11 +1267,11 @@
}
public:
PredecessorValidator(IR* hir) {
ResourceMark rm;
- _predecessors = new BlockListList(BlockBegin::number_of_blocks(), NULL);
+ _predecessors = new BlockListList(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL);
_blocks = new BlockList();
int i;
hir->start()->iterate_preorder(this);
if (hir->code() != NULL) {
< prev index next >