# HG changeset patch # User fzhinkin # Date 1459431593 -10800 # Thu Mar 31 16:39:53 2016 +0300 # Node ID b0cc8d57acbced4b485783fcf70bd6f0897a112a # Parent 4bf8a911582b8d1661142584a7e97e47f2387428 imported patch c1_Compilation diff --git a/src/share/vm/c1/c1_Compilation.hpp b/src/share/vm/c1/c1_Compilation.hpp --- a/src/share/vm/c1/c1_Compilation.hpp +++ b/src/share/vm/c1/c1_Compilation.hpp @@ -53,12 +53,9 @@ class CFGPrinter; typedef LIR_OprDesc* LIR_Opr; - -define_array(BasicTypeArray, BasicType) -define_stack(BasicTypeList, BasicTypeArray) - -define_array(ExceptionInfoArray, ExceptionInfo*) -define_stack(ExceptionInfoList, ExceptionInfoArray) +typedef GrowableArray BasicTypeArray; +typedef GrowableArray BasicTypeList; +typedef GrowableArray ExceptionInfoList; class Compilation: public StackObj { friend class CompilationResourceObj; diff --git a/src/share/vm/c1/c1_FrameMap.hpp b/src/share/vm/c1/c1_FrameMap.hpp --- a/src/share/vm/c1/c1_FrameMap.hpp +++ b/src/share/vm/c1/c1_FrameMap.hpp @@ -36,8 +36,8 @@ class ciMethod; class CallingConvention; -class BasicTypeArray; -class BasicTypeList; +//class BasicTypeArray; +//class BasicTypeList; //-------------------------------------------------------- // FrameMap # HG changeset patch # User fzhinkin # Date 1459431598 -10800 # Thu Mar 31 16:39:58 2016 +0300 # Node ID 5665e62b40720602da7854329b8a8f2ed343f660 # Parent b0cc8d57acbced4b485783fcf70bd6f0897a112a imported patch c1_ValueMap diff --git a/src/share/vm/c1/c1_ValueMap.cpp b/src/share/vm/c1/c1_ValueMap.cpp --- a/src/share/vm/c1/c1_ValueMap.cpp +++ b/src/share/vm/c1/c1_ValueMap.cpp @@ -46,7 +46,7 @@ ValueMap::ValueMap() : _nesting(0) - , _entries(ValueMapInitialSize, NULL) + , _entries(ValueMapInitialSize, ValueMapInitialSize, NULL) , _killed_values() , _entry_count(0) { @@ -72,7 +72,7 @@ int new_size = old_size * 2 + 1; ValueMapEntryList worklist(8); - ValueMapEntryArray new_entries(new_size, NULL); + ValueMapEntryArray new_entries(new_size, new_size, NULL); int new_entry_count = 0; TRACE_VALUE_NUMBERING(tty->print_cr("increasing table size from %d to %d", old_size, new_size)); @@ -486,7 +486,7 @@ GlobalValueNumbering::GlobalValueNumbering(IR* ir) : _current_map(NULL) - , _value_maps(ir->linear_scan_order()->length(), NULL) + , _value_maps(ir->linear_scan_order()->length(), ir->linear_scan_order()->length(), NULL) , _compilation(ir->compilation()) { TRACE_VALUE_NUMBERING(tty->print_cr("****** start of global value numbering")); diff --git a/src/share/vm/c1/c1_ValueMap.hpp b/src/share/vm/c1/c1_ValueMap.hpp --- a/src/share/vm/c1/c1_ValueMap.hpp +++ b/src/share/vm/c1/c1_ValueMap.hpp @@ -53,8 +53,8 @@ void set_next(ValueMapEntry* next) { _next = next; } }; -define_array(ValueMapEntryArray, ValueMapEntry*) -define_stack(ValueMapEntryList, ValueMapEntryArray) +typedef GrowableArray ValueMapEntryArray; +typedef GrowableArray ValueMapEntryList; // ValueMap implements nested hash tables for value numbering. It // maintains a set _killed_values which represents the instructions @@ -129,8 +129,7 @@ #endif }; -define_array(ValueMapArray, ValueMap*) - +typedef GrowableArray ValueMapArray; class ValueNumberingVisitor: public InstructionVisitor { protected: # HG changeset patch # User fzhinkin # Date 1459431604 -10800 # Thu Mar 31 16:40:04 2016 +0300 # Node ID 4f56df6ccadd0cb19cd7f1db6c303cd46964bc2f # Parent 5665e62b40720602da7854329b8a8f2ed343f660 imported patch c1_Optimizer diff --git a/src/share/vm/c1/c1_Optimizer.cpp b/src/share/vm/c1/c1_Optimizer.cpp --- a/src/share/vm/c1/c1_Optimizer.cpp +++ b/src/share/vm/c1/c1_Optimizer.cpp @@ -31,9 +31,7 @@ #include "utilities/bitMap.inline.hpp" #include "compiler/compileLog.hpp" -define_array(ValueSetArray, ValueSet*); -define_stack(ValueSetList, ValueSetArray); - +typedef GrowableArray ValueSetList; Optimizer::Optimizer(IR* ir) { assert(ir->is_valid(), "IR must be valid"); @@ -583,8 +581,8 @@ ValueSet* state() { return _set; } void set_state_from (ValueSet* state) { _set->set_from(state); } - ValueSet* state_for (BlockBegin* block) { return _block_states[block->block_id()]; } - void set_state_for (BlockBegin* block, ValueSet* stack) { _block_states[block->block_id()] = stack; } + ValueSet* state_for (BlockBegin* block) { return _block_states.at(block->block_id()); } + void set_state_for (BlockBegin* block, ValueSet* stack) { _block_states.at_put(block->block_id(), stack); } // Returns true if caused a change in the block's state. bool merge_state_for(BlockBegin* block, ValueSet* incoming_state); @@ -595,7 +593,7 @@ : _opt(opt) , _set(new ValueSet()) , _last_explicit_null_check(NULL) - , _block_states(BlockBegin::number_of_blocks(), NULL) + , _block_states(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL) , _work_list(new BlockList()) { _visitable_instructions = new ValueSet(); _visitor.set_eliminator(this); # HG changeset patch # User fzhinkin # Date 1459431609 -10800 # Thu Mar 31 16:40:09 2016 +0300 # Node ID 2bce64120fd821484a5b6324d0ea11bf8e41b674 # Parent 4f56df6ccadd0cb19cd7f1db6c303cd46964bc2f imported patch c1_IR diff --git a/src/share/vm/c1/c1_IR.cpp b/src/share/vm/c1/c1_IR.cpp --- a/src/share/vm/c1/c1_IR.cpp +++ b/src/share/vm/c1/c1_IR.cpp @@ -1255,8 +1255,7 @@ } -define_array(BlockListArray, BlockList*) -define_stack(BlockListList, BlockListArray) +typedef GrowableArray BlockListList; class PredecessorValidator : public BlockClosure { private: @@ -1270,7 +1269,7 @@ 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; diff --git a/src/share/vm/c1/c1_IR.hpp b/src/share/vm/c1/c1_IR.hpp --- a/src/share/vm/c1/c1_IR.hpp +++ b/src/share/vm/c1/c1_IR.hpp @@ -104,9 +104,7 @@ bool equals(XHandler* other) const; }; -define_array(_XHandlerArray, XHandler*) -define_stack(_XHandlerList, _XHandlerArray) - +typedef GrowableArray _XHandlerList; // XHandlers is the C1 internal list of exception handlers for a method class XHandlers: public CompilationResourceObj { # HG changeset patch # User fzhinkin # Date 1459431615 -10800 # Thu Mar 31 16:40:15 2016 +0300 # Node ID d6295e1975369cd996e49253ad8df23c5a41c279 # Parent 2bce64120fd821484a5b6324d0ea11bf8e41b674 imported patch c1_LIR diff --git a/src/share/vm/c1/c1_LIR.hpp b/src/share/vm/c1/c1_LIR.hpp --- a/src/share/vm/c1/c1_LIR.hpp +++ b/src/share/vm/c1/c1_LIR.hpp @@ -59,17 +59,9 @@ typedef LIR_OprDesc* LIR_Opr; typedef int RegNr; -define_array(LIR_OprArray, LIR_Opr) -define_stack(LIR_OprList, LIR_OprArray) - -define_array(LIR_OprRefArray, LIR_Opr*) -define_stack(LIR_OprRefList, LIR_OprRefArray) - -define_array(CodeEmitInfoArray, CodeEmitInfo*) -define_stack(CodeEmitInfoList, CodeEmitInfoArray) - -define_array(LIR_OpArray, LIR_Op*) -define_stack(LIR_OpList, LIR_OpArray) +typedef GrowableArray LIR_OprList; +typedef GrowableArray LIR_OpArray; +typedef GrowableArray LIR_OpList; // define LIR_OprPtr early so LIR_OprDesc can refer to it class LIR_OprPtr: public CompilationResourceObj { @@ -2054,7 +2046,10 @@ void append(LIR_InsertionBuffer* buffer); //---------- mutators --------------- - void insert_before(int i, LIR_List* op_list) { _operations.insert_before(i, op_list->instructions_list()); } + void insert_before(int i, LIR_List* op_list) { + for (int j = 0; j < op_list->instructions_list()->length(); j++) + _operations.insert_before(i + j, op_list->instructions_list()->at(j)); + } void insert_before(int i, LIR_Op* op) { _operations.insert_before(i, op); } void remove_at(int i) { _operations.remove_at(i); } diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -3041,7 +3041,7 @@ insert_point++; } } - instructions->truncate(insert_point); + instructions->trunc_to(insert_point); } } @@ -4451,7 +4451,7 @@ 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; @@ -6230,7 +6230,7 @@ } old_pos++; } - code->truncate(new_pos); + code->trunc_to(new_pos); DEBUG_ONLY(verify(code)); } @@ -6255,7 +6255,7 @@ 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); @@ -6294,7 +6294,7 @@ 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()); diff --git a/src/share/vm/utilities/growableArray.hpp b/src/share/vm/utilities/growableArray.hpp --- a/src/share/vm/utilities/growableArray.hpp +++ b/src/share/vm/utilities/growableArray.hpp @@ -250,6 +250,10 @@ return _data[_len-1]; } + E last() const { + return top(); + } + GrowableArrayIterator begin() const { return GrowableArrayIterator(this, 0); } # HG changeset patch # User fzhinkin # Date 1459431620 -10800 # Thu Mar 31 16:40:20 2016 +0300 # Node ID b9773d05a7fa20995f2b1af96204f67a19cc1a54 # Parent d6295e1975369cd996e49253ad8df23c5a41c279 imported patch c1_IR_IRscope diff --git a/src/share/vm/c1/c1_IR.hpp b/src/share/vm/c1/c1_IR.hpp --- a/src/share/vm/c1/c1_IR.hpp +++ b/src/share/vm/c1/c1_IR.hpp @@ -130,8 +130,7 @@ class IRScope; -define_array(IRScopeArray, IRScope*) -define_stack(IRScopeList, IRScopeArray) +typedef GrowableArray IRScopeList; class Compilation; class IRScope: public CompilationResourceObj { # HG changeset patch # User fzhinkin # Date 1459431626 -10800 # Thu Mar 31 16:40:26 2016 +0300 # Node ID 9160a9536d5ebdbf36eba5930df398001285c41b # Parent b9773d05a7fa20995f2b1af96204f67a19cc1a54 imported patch c1_CodeStubs diff --git a/src/share/vm/c1/c1_CodeStubs.hpp b/src/share/vm/c1/c1_CodeStubs.hpp --- a/src/share/vm/c1/c1_CodeStubs.hpp +++ b/src/share/vm/c1/c1_CodeStubs.hpp @@ -77,17 +77,13 @@ } }; - -define_array(CodeStubArray, CodeStub*) -define_stack(_CodeStubList, CodeStubArray) - -class CodeStubList: public _CodeStubList { +class CodeStubList: public GrowableArray { public: - CodeStubList(): _CodeStubList() {} + CodeStubList(): GrowableArray() {} void append(CodeStub* stub) { if (!contains(stub)) { - _CodeStubList::append(stub); + GrowableArray::append(stub); } } }; diff --git a/src/share/vm/c1/c1_LIRAssembler.cpp b/src/share/vm/c1/c1_LIRAssembler.cpp --- a/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/src/share/vm/c1/c1_LIRAssembler.cpp @@ -127,7 +127,7 @@ void LIR_Assembler::emit_stubs(CodeStubList* stub_list) { for (int m = 0; m < stub_list->length(); m++) { - CodeStub* s = (*stub_list)[m]; + CodeStub* s = stub_list->at(m); check_codespace(); CHECK_BAILOUT(); # HG changeset patch # User fzhinkin # Date 1459431632 -10800 # Thu Mar 31 16:40:32 2016 +0300 # Node ID c2662c885673bcd708ff5b0301efac8e59101857 # Parent 9160a9536d5ebdbf36eba5930df398001285c41b imported patch c1_LIRGenerator diff --git a/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp --- a/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +++ b/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -1127,7 +1127,7 @@ void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp b/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp --- a/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp +++ b/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp @@ -1055,7 +1055,7 @@ void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -1033,7 +1033,7 @@ void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -1260,7 +1260,7 @@ void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -150,7 +150,7 @@ int i; // resolve any cycles in moves from and to virtual registers for (i = virtual_operands().length() - 1; i >= 0; i --) { - ResolveNode* node = virtual_operands()[i]; + ResolveNode* node = virtual_operands().at(i); if (!node->visited()) { _loop = NULL; move(NULL, node); @@ -161,7 +161,7 @@ // generate move for move from non virtual register to abitrary destination for (i = other_operands().length() - 1; i >= 0; i --) { - ResolveNode* node = other_operands()[i]; + ResolveNode* node = other_operands().at(i); for (int j = node->no_of_destinations() - 1; j >= 0; j --) { emit_move(node->operand(), node->destination_at(j)->operand()); } @@ -177,7 +177,7 @@ assert(node == NULL || node->operand() == opr, ""); if (node == NULL) { node = new ResolveNode(opr); - vreg_table()[vreg_num] = node; + vreg_table().at_put(vreg_num, node); } // Make sure that all virtual operands show up in the list when // they are used as the source of a move. diff --git a/src/share/vm/c1/c1_LIRGenerator.hpp b/src/share/vm/c1/c1_LIRGenerator.hpp --- a/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/src/share/vm/c1/c1_LIRGenerator.hpp @@ -39,8 +39,7 @@ class SwitchRange; class LIRItem; -define_array(LIRItemArray, LIRItem*) -define_stack(LIRItemList, LIRItemArray) +typedef GrowableArray LIRItemList; class SwitchRange: public CompilationResourceObj { private: @@ -56,15 +55,12 @@ BlockBegin* sux() const { return _sux; } }; -define_array(SwitchRangeArray, SwitchRange*) -define_stack(SwitchRangeList, SwitchRangeArray) - +typedef GrowableArray SwitchRangeArray; +typedef GrowableArray SwitchRangeList; class ResolveNode; -define_array(NodeArray, ResolveNode*); -define_stack(NodeList, NodeArray); - +typedef GrowableArray NodeList; // Node objects form a directed graph of LIR_Opr // Edges between Nodes represent moves from one Node to its destinations @@ -86,7 +82,7 @@ // accessors LIR_Opr operand() const { return _operand; } int no_of_destinations() const { return _destinations.length(); } - ResolveNode* destination_at(int i) { return _destinations[i]; } + ResolveNode* destination_at(int i) { return _destinations.at(i); } bool assigned() const { return _assigned; } bool visited() const { return _visited; } bool start_node() const { return _start_node; } # HG changeset patch # User fzhinkin # Date 1459431637 -10800 # Thu Mar 31 16:40:37 2016 +0300 # Node ID 61ba2d0eb5a7f47e0c9b16055ff27bcea4d6a0ad # Parent c2662c885673bcd708ff5b0301efac8e59101857 imported patch c1_Instruction diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1732,7 +1732,7 @@ if (obj_args == NULL) { return NULL; } - int s = obj_args->size(); + int s = obj_args->length(); // if called through method handle invoke, some arguments may have been popped for (int i = start, j = 0; j < s && i < args->length(); i++) { if (args->at(i)->type()->is_object_kind()) { @@ -2169,7 +2169,7 @@ ciKlass* klass = stream()->get_klass(will_link); ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_exhandling(); - Values* dims = new Values(dimensions, NULL); + Values* dims = new Values(dimensions, dimensions, NULL); // fill in all dimensions int i = dimensions; while (i-- > 0) dims->at_put(i, ipop()); @@ -3772,9 +3772,9 @@ int start = 0; Values* obj_args = args_list_for_profiling(callee, start, has_receiver); if (obj_args != NULL) { - int s = obj_args->size(); + int s = obj_args->length(); // if called through method handle invoke, some arguments may have been popped - for (int i = args_base+start, j = 0; j < obj_args->size() && i < state()->stack_size(); ) { + for (int i = args_base+start, j = 0; j < obj_args->length() && i < state()->stack_size(); ) { Value v = state()->stack_at_inc(i); if (v->type()->is_object_kind()) { obj_args->push(v); diff --git a/src/share/vm/c1/c1_Instruction.hpp b/src/share/vm/c1/c1_Instruction.hpp --- a/src/share/vm/c1/c1_Instruction.hpp +++ b/src/share/vm/c1/c1_Instruction.hpp @@ -115,11 +115,8 @@ // A Value is a reference to the instruction creating the value typedef Instruction* Value; -define_array(ValueArray, Value) -define_stack(Values, ValueArray) - -define_array(ValueStackArray, ValueStack*) -define_stack(ValueStackStack, ValueStackArray) +typedef GrowableArray Values; +typedef GrowableArray ValueStackStack; // BlockClosure is the base class for block traversal/iteration. diff --git a/src/share/vm/c1/c1_ValueStack.cpp b/src/share/vm/c1/c1_ValueStack.cpp --- a/src/share/vm/c1/c1_ValueStack.cpp +++ b/src/share/vm/c1/c1_ValueStack.cpp @@ -35,7 +35,7 @@ , _caller_state(caller_state) , _bci(-99) , _kind(Parsing) -, _locals(scope->method()->max_locals(), NULL) +, _locals(scope->method()->max_locals(), scope->method()->max_locals(), NULL) , _stack(scope->method()->max_stack()) , _locks() { @@ -178,7 +178,7 @@ ValueType* t = stack_at(index)->type(); Value phi = new Phi(t, b, -index - 1); - _stack[index] = phi; + _stack.at_put(index, phi); assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL"); } @@ -225,7 +225,7 @@ if (locals_size() > 0) { InstructionPrinter ip; for (int i = 0; i < locals_size();) { - Value l = _locals[i]; + Value l = _locals.at(i); tty->print("local %d ", i); if (l == NULL) { tty->print("null"); # HG changeset patch # User fzhinkin # Date 1459431646 -10800 # Thu Mar 31 16:40:46 2016 +0300 # Node ID 191641e312090b9c82c1411c1b23e3c2e698de94 # Parent 61ba2d0eb5a7f47e0c9b16055ff27bcea4d6a0ad imported patch some fixes diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -495,7 +495,7 @@ } // initialize with correct length - _lir_ops = LIR_OpArray(num_instructions); + _lir_ops = LIR_OpArray(num_instructions, num_instructions, NULL); _block_of_op = BlockBeginArray(num_instructions); int op_id = 0; diff --git a/src/share/vm/c1/c1_ValueMap.cpp b/src/share/vm/c1/c1_ValueMap.cpp --- a/src/share/vm/c1/c1_ValueMap.cpp +++ b/src/share/vm/c1/c1_ValueMap.cpp @@ -56,7 +56,7 @@ ValueMap::ValueMap(ValueMap* old) : _nesting(old->_nesting + 1) - , _entries(old->_entries.length()) + , _entries(old->_entries.length(), old->_entries.length(), NULL) , _killed_values() , _entry_count(old->_entry_count) { # HG changeset patch # User fzhinkin # Date 1459431730 -10800 # Thu Mar 31 16:42:10 2016 +0300 # Node ID f82af7e83985d896b9b8eb0d60733a31943bc4ac # Parent 191641e312090b9c82c1411c1b23e3c2e698de94 imported patch c1_Instruction_BBA diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -4091,7 +4091,7 @@ // properly clone all blocks in jsr region as well as exception // handlers containing rets BlockList* new_bci2block = new BlockList(bci2block()->length()); - new_bci2block->push_all(bci2block()); + new_bci2block->appendAll(bci2block()); data->set_bci2block(new_bci2block); data->set_scope(scope()); data->setup_jsr_xhandlers(); diff --git a/src/share/vm/c1/c1_IR.cpp b/src/share/vm/c1/c1_IR.cpp --- a/src/share/vm/c1/c1_IR.cpp +++ b/src/share/vm/c1/c1_IR.cpp @@ -848,13 +848,13 @@ 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_from_end(cur) == -1, "block already processed (block can be ready only once)"); + assert(_work_list.find_from_end(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_from_end(cur) == -1, "block already in work list"); int cur_weight = compute_weight(cur); @@ -890,7 +890,7 @@ 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_from_end(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 @@ -1115,13 +1115,13 @@ 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_from_end(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_from_end(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"); } @@ -1133,7 +1133,7 @@ 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_from_end(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"); } diff --git a/src/share/vm/c1/c1_Instruction.cpp b/src/share/vm/c1/c1_Instruction.cpp --- a/src/share/vm/c1/c1_Instruction.cpp +++ b/src/share/vm/c1/c1_Instruction.cpp @@ -564,7 +564,7 @@ for (int s = 0; s < from->number_of_sux();) { BlockBegin* sux = from->sux_at(s); if (sux == to) { - int index = sux->_predecessors.index_of(from); + int index = sux->_predecessors.find_from_end(from); if (index >= 0) { sux->_predecessors.remove_at(index); } @@ -664,7 +664,7 @@ void BlockBegin::remove_successor(BlockBegin* pred) { int idx; - while ((idx = _successors.index_of(pred)) >= 0) { + while ((idx = _successors.find_from_end(pred)) >= 0) { _successors.remove_at(idx); } } @@ -677,7 +677,7 @@ void BlockBegin::remove_predecessor(BlockBegin* pred) { int idx; - while ((idx = _predecessors.index_of(pred)) >= 0) { + while ((idx = _predecessors.find_from_end(pred)) >= 0) { _predecessors.remove_at(idx); } } diff --git a/src/share/vm/c1/c1_Instruction.hpp b/src/share/vm/c1/c1_Instruction.hpp --- a/src/share/vm/c1/c1_Instruction.hpp +++ b/src/share/vm/c1/c1_Instruction.hpp @@ -134,14 +134,13 @@ // Some array and list classes -define_array(BlockBeginArray, BlockBegin*) -define_stack(_BlockList, BlockBeginArray) - -class BlockList: public _BlockList { +typedef GrowableArray BlockBeginArray; + +class BlockList: public GrowableArray { public: - BlockList(): _BlockList() {} - BlockList(const int size): _BlockList(size) {} - BlockList(const int size, BlockBegin* init): _BlockList(size, init) {} + BlockList(): GrowableArray() {} + BlockList(const int size): GrowableArray(size) {} + BlockList(const int size, BlockBegin* init): GrowableArray(size, size, init) {} void iterate_forward(BlockClosure* closure); void iterate_backward(BlockClosure* closure); @@ -1741,7 +1740,7 @@ void remove_predecessor(BlockBegin* pred); bool is_predecessor(BlockBegin* pred) const { return _predecessors.contains(pred); } int number_of_preds() const { return _predecessors.length(); } - BlockBegin* pred_at(int i) const { return _predecessors[i]; } + BlockBegin* pred_at(int i) const { return _predecessors.at(i); } // exception handlers potentially invoked by this block void add_exception_handler(BlockBegin* b); diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -496,7 +496,7 @@ // initialize with correct length _lir_ops = LIR_OpArray(num_instructions, num_instructions, NULL); - _block_of_op = BlockBeginArray(num_instructions); + _block_of_op = BlockBeginArray(num_instructions, num_instructions, NULL); int op_id = 0; int idx = 0; @@ -6210,7 +6210,7 @@ _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_from_end(pred) == -1) { _original_preds.append(pred); } } @@ -6377,19 +6377,19 @@ 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_from_end(op_branch->block()) != -1, "branch target not valid"); + assert(op_branch->ublock() == NULL || code->find_from_end(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_from_end(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_from_end(pred) != -1, "successor not valid"); } } } diff --git a/src/share/vm/c1/c1_Optimizer.cpp b/src/share/vm/c1/c1_Optimizer.cpp --- a/src/share/vm/c1/c1_Optimizer.cpp +++ b/src/share/vm/c1/c1_Optimizer.cpp @@ -1167,7 +1167,7 @@ blocks.push(ir()->start()); visited_block[ir()->start()->block_id()] = true; for (int i = 0; i < blocks.length(); i++) { - BlockBegin* b = blocks[i]; + BlockBegin* b = blocks.at(i); // exception handlers need to be treated as additional roots for (int e = b->number_of_exception_handlers(); e-- > 0; ) { BlockBegin* excp = b->exception_handler_at(e); diff --git a/src/share/vm/c1/c1_RangeCheckElimination.cpp b/src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -1149,8 +1149,8 @@ for (int i=0; i<_used.length(); i++) { _used[i] = false; } - _current.truncate(0); - _successors.truncate(0); + _current.trunc_to(0); + _successors.trunc_to(0); if (start != dont_use) { _current.push(start); _used[start->block_id()] = true; @@ -1180,7 +1180,7 @@ } } for (int i=0; i<_successors.length(); i++) { - BlockBegin *sux = _successors[i]; + BlockBegin *sux = _successors.at(i); assert(sux != NULL, "Successor must not be NULL!"); if (sux == end) { return true; @@ -1190,7 +1190,7 @@ _current.push(sux); } } - _successors.truncate(0); + _successors.trunc_to(0); } return false; diff --git a/src/share/vm/c1/c1_RangeCheckElimination.hpp b/src/share/vm/c1/c1_RangeCheckElimination.hpp --- a/src/share/vm/c1/c1_RangeCheckElimination.hpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.hpp @@ -40,8 +40,7 @@ bool _optimistic; // Insert predicates and deoptimize when they fail IR *_ir; - define_array(BlockBeginArray, BlockBegin*) - define_stack(BlockBeginList, BlockBeginArray) + typedef GrowableArray BlockBeginList; define_stack(IntegerStack, intArray) define_array(IntegerMap, IntegerStack*) # HG changeset patch # User fzhinkin # Date 1459431735 -10800 # Thu Mar 31 16:42:15 2016 +0300 # Node ID dd20dc1c9fe58b0aab23de36d6aa8d0955eb6b77 # Parent f82af7e83985d896b9b8eb0d60733a31943bc4ac imported patch c1_Instruction_BPA diff --git a/src/share/vm/c1/c1_Instruction.hpp b/src/share/vm/c1/c1_Instruction.hpp --- a/src/share/vm/c1/c1_Instruction.hpp +++ b/src/share/vm/c1/c1_Instruction.hpp @@ -2605,10 +2605,7 @@ void set_from(BlockBegin* b) { _from = b; } }; - -define_array(BlockPairArray, BlockPair*) -define_stack(BlockPairList, BlockPairArray) - +typedef GrowableArray BlockPairList; inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); } inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); } # HG changeset patch # User fzhinkin # Date 1459431742 -10800 # Thu Mar 31 16:42:22 2016 +0300 # Node ID 301dbcbb08b64529b95533284e15abafdff904bf # Parent dd20dc1c9fe58b0aab23de36d6aa8d0955eb6b77 imported patch c1_LinearScan diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -2506,7 +2506,8 @@ 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) { @@ -3445,7 +3446,7 @@ 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); diff --git a/src/share/vm/c1/c1_LinearScan.hpp b/src/share/vm/c1/c1_LinearScan.hpp --- a/src/share/vm/c1/c1_LinearScan.hpp +++ b/src/share/vm/c1/c1_LinearScan.hpp @@ -44,18 +44,9 @@ typedef GrowableArray IntervalArray; typedef GrowableArray IntervalList; - -define_array(IntervalsArray, IntervalList*) -define_stack(IntervalsList, IntervalsArray) - -define_array(OopMapArray, OopMap*) -define_stack(OopMapList, OopMapArray) - -define_array(ScopeValueArray, ScopeValue*) - -define_array(LIR_OpListArray, LIR_OpList*); -define_stack(LIR_OpListStack, LIR_OpListArray); - +typedef GrowableArray IntervalsList; +typedef GrowableArray ScopeValueArray; +typedef GrowableArray LIR_OpListStack; enum IntervalUseKind { // priority of use kinds must be ascending @@ -67,9 +58,6 @@ firstValidKind = 1, lastValidKind = 3 }; -define_array(UseKindArray, IntervalUseKind) -define_stack(UseKindStack, UseKindArray) - enum IntervalKind { fixedKind = 0, // interval pre-colored by LIR_Generator # HG changeset patch # User fzhinkin # Date 1459431747 -10800 # Thu Mar 31 16:42:27 2016 +0300 # Node ID ee5f3337f64d1596ed3148930b501e37b1ae65ee # Parent 301dbcbb08b64529b95533284e15abafdff904bf imported patch c1_RCE diff --git a/src/share/vm/c1/c1_RangeCheckElimination.cpp b/src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -53,8 +53,8 @@ // Constructor RangeCheckEliminator::RangeCheckEliminator(IR *ir) : - _bounds(Instruction::number_of_instructions(), NULL), - _access_indexed_info(Instruction::number_of_instructions(), NULL) + _bounds(Instruction::number_of_instructions(), Instruction::number_of_instructions(), NULL), + _access_indexed_info(Instruction::number_of_instructions(), Instruction::number_of_instructions(), NULL) { _visitor.set_range_check_eliminator(this); _ir = ir; @@ -303,28 +303,28 @@ // Wrong type or NULL -> No bound if (!v || (!v->type()->as_IntType() && !v->type()->as_ObjectType())) return NULL; - if (!_bounds[v->id()]) { + if (!_bounds.at(v->id())) { // First (default) bound is calculated // Create BoundStack - _bounds[v->id()] = new BoundStack(); + _bounds.at_put(v->id(), new BoundStack()); _visitor.clear_bound(); Value visit_value = v; visit_value->visit(&_visitor); Bound *bound = _visitor.bound(); if (bound) { - _bounds[v->id()]->push(bound); + _bounds.at(v->id())->push(bound); } - if (_bounds[v->id()]->length() == 0) { + if (_bounds.at(v->id())->length() == 0) { assert(!(v->as_Constant() && v->type()->as_IntConstant()), "constants not handled here"); - _bounds[v->id()]->push(new Bound()); + _bounds.at(v->id())->push(new Bound()); } - } else if (_bounds[v->id()]->length() == 0) { + } else if (_bounds.at(v->id())->length() == 0) { // To avoid endless loops, bound is currently in calculation -> nothing known about it return new Bound(); } // Return bound - return _bounds[v->id()]->top(); + return _bounds.at(v->id())->top(); } // Update bound @@ -353,28 +353,28 @@ // No bound update for constants return; } - if (!_bounds[v->id()]) { + if (!_bounds.at(v->id())) { get_bound(v); - assert(_bounds[v->id()], "Now Stack must exist"); + assert(_bounds.at(v->id()), "Now Stack must exist"); } Bound *top = NULL; - if (_bounds[v->id()]->length() > 0) { - top = _bounds[v->id()]->top(); + if (_bounds.at(v->id())->length() > 0) { + top = _bounds.at(v->id())->top(); } if (top) { bound->and_op(top); } - _bounds[v->id()]->push(bound); + _bounds.at(v->id())->push(bound); pushed.append(v->id()); } // Add instruction + idx for in block motion void RangeCheckEliminator::add_access_indexed_info(InstructionList &indices, int idx, Value instruction, AccessIndexed *ai) { int id = instruction->id(); - AccessIndexedInfo *aii = _access_indexed_info[id]; + AccessIndexedInfo *aii = _access_indexed_info.at(id); if (aii == NULL) { aii = new AccessIndexedInfo(); - _access_indexed_info[id] = aii; + _access_indexed_info.at_put(id, aii); indices.append(instruction); aii->_min = idx; aii->_max = idx; @@ -461,7 +461,7 @@ if (_optimistic) { for (int i = 0; i < indices.length(); i++) { Instruction *index_instruction = indices.at(i); - AccessIndexedInfo *info = _access_indexed_info[index_instruction->id()]; + AccessIndexedInfo *info = _access_indexed_info.at(index_instruction->id()); assert(info != NULL, "Info must not be null"); // if idx < 0, max > 0, max + idx may fall between 0 and @@ -562,7 +562,7 @@ // Clear data structures for next array for (int i = 0; i < indices.length(); i++) { Instruction *index_instruction = indices.at(i); - _access_indexed_info[index_instruction->id()] = NULL; + _access_indexed_info.at_put(index_instruction->id(), NULL); } indices.clear(); } @@ -1005,7 +1005,7 @@ // Reset stack for (int i=0; ipop(); + _bounds.at(pushed.at(i))->pop(); } } diff --git a/src/share/vm/c1/c1_RangeCheckElimination.hpp b/src/share/vm/c1/c1_RangeCheckElimination.hpp --- a/src/share/vm/c1/c1_RangeCheckElimination.hpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.hpp @@ -41,8 +41,7 @@ IR *_ir; typedef GrowableArray BlockBeginList; - define_stack(IntegerStack, intArray) - define_array(IntegerMap, IntegerStack*) + typedef GrowableArray IntegerStack; class Verification : public BlockClosure { // RangeCheckEliminator::Verification should never get instatiated on the heap. @@ -179,13 +178,10 @@ void add_assertions(Bound *bound, Instruction *instruction, Instruction *position); #endif - define_array(BoundArray, Bound *) - define_stack(BoundStack, BoundArray) - define_array(BoundMap, BoundStack *) - define_array(AccessIndexedArray, AccessIndexed *) - define_stack(AccessIndexedList, AccessIndexedArray) - define_array(InstructionArray, Instruction *) - define_stack(InstructionList, InstructionArray) + typedef GrowableArray BoundStack; + typedef GrowableArray BoundMap; + typedef GrowableArray AccessIndexedList; + typedef GrowableArray InstructionList; class AccessIndexedInfo : public CompilationResourceObj { public: @@ -194,7 +190,7 @@ int _max; }; - define_array(AccessIndexedInfoArray, AccessIndexedInfo *) + typedef GrowableArray AccessIndexedInfoArray; BoundMap _bounds; // Mapping from Instruction's id to current bound AccessIndexedInfoArray _access_indexed_info; // Mapping from Instruction's id to AccessIndexedInfo for in block motion Visitor _visitor; # HG changeset patch # User fzhinkin # Date 1459431755 -10800 # Thu Mar 31 16:42:35 2016 +0300 # Node ID 879b599f3aa5bf15722ebc3df14a6323034e2cd6 # Parent ee5f3337f64d1596ed3148930b501e37b1ae65ee imported patch minor fixes diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1721,7 +1721,7 @@ bool ignored_will_link; ciSignature* declared_signature = NULL; ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); - assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); + assert(expected == obj_args->max_length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); #endif } @@ -1732,7 +1732,7 @@ if (obj_args == NULL) { return NULL; } - int s = obj_args->length(); + int s = obj_args->max_length(); // if called through method handle invoke, some arguments may have been popped for (int i = start, j = 0; j < s && i < args->length(); i++) { if (args->at(i)->type()->is_object_kind()) { @@ -3772,9 +3772,9 @@ int start = 0; Values* obj_args = args_list_for_profiling(callee, start, has_receiver); if (obj_args != NULL) { - int s = obj_args->length(); + int s = obj_args->max_length(); // if called through method handle invoke, some arguments may have been popped - for (int i = args_base+start, j = 0; j < obj_args->length() && i < state()->stack_size(); ) { + for (int i = args_base+start, j = 0; j < obj_args->max_length() && i < state()->stack_size(); ) { Value v = state()->stack_at_inc(i); if (v->type()->is_object_kind()) { obj_args->push(v); diff --git a/src/share/vm/c1/c1_LIR.hpp b/src/share/vm/c1/c1_LIR.hpp --- a/src/share/vm/c1/c1_LIR.hpp +++ b/src/share/vm/c1/c1_LIR.hpp @@ -2046,10 +2046,7 @@ void append(LIR_InsertionBuffer* buffer); //---------- mutators --------------- - void insert_before(int i, LIR_List* op_list) { - for (int j = 0; j < op_list->instructions_list()->length(); j++) - _operations.insert_before(i + j, op_list->instructions_list()->at(j)); - } + void insert_before(int i, LIR_List* op_list) { _operations.insert_before(i, op_list->instructions_list()); } void insert_before(int i, LIR_Op* op) { _operations.insert_before(i, op); } void remove_at(int i) { _operations.remove_at(i); } diff --git a/src/share/vm/utilities/growableArray.hpp b/src/share/vm/utilities/growableArray.hpp --- a/src/share/vm/utilities/growableArray.hpp +++ b/src/share/vm/utilities/growableArray.hpp @@ -367,6 +367,24 @@ _data[idx] = elem; } + void insert_before(const int idx, const GrowableArray* array) { + assert(0 <= idx && idx <= _len, "illegal index"); + check_nesting(); + int array_len = array->length(); + int new_len = _len + array_len; + if (new_len >= _max) grow(new_len); + + for (int j = _len - 1; j >= idx; j--) { + _data[j + array_len] = _data[j]; + } + + for (int j = 0; j < array_len; j++) { + _data[idx + j] = array->_data[j]; + } + + _len += array_len; + } + void appendAll(const GrowableArray* l) { for (int i = 0; i < l->_len; i++) { raw_at_put_grow(_len, l->_data[i], E()); # HG changeset patch # User fzhinkin # Date 1459431760 -10800 # Thu Mar 31 16:42:40 2016 +0300 # Node ID 759219519a441e95a97e3f09a11654dd6e102a37 # Parent 879b599f3aa5bf15722ebc3df14a6323034e2cd6 imported patch s/find_from_end/find/g diff --git a/src/share/vm/c1/c1_IR.cpp b/src/share/vm/c1/c1_IR.cpp --- a/src/share/vm/c1/c1_IR.cpp +++ b/src/share/vm/c1/c1_IR.cpp @@ -848,13 +848,13 @@ return false; } - assert(_linear_scan_order->find_from_end(cur) == -1, "block already processed (block can be ready only once)"); - assert(_work_list.find_from_end(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.find_from_end(cur) == -1, "block already in work list"); + assert(_work_list.find(cur) == -1, "block already in work list"); int cur_weight = compute_weight(cur); @@ -890,7 +890,7 @@ 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->find_from_end(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 @@ -1115,13 +1115,13 @@ 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->find_from_end(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->find_from_end(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"); } @@ -1133,7 +1133,7 @@ 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->find_from_end(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"); } diff --git a/src/share/vm/c1/c1_Instruction.cpp b/src/share/vm/c1/c1_Instruction.cpp --- a/src/share/vm/c1/c1_Instruction.cpp +++ b/src/share/vm/c1/c1_Instruction.cpp @@ -564,7 +564,7 @@ for (int s = 0; s < from->number_of_sux();) { BlockBegin* sux = from->sux_at(s); if (sux == to) { - int index = sux->_predecessors.find_from_end(from); + int index = sux->_predecessors.find(from); if (index >= 0) { sux->_predecessors.remove_at(index); } @@ -664,7 +664,7 @@ void BlockBegin::remove_successor(BlockBegin* pred) { int idx; - while ((idx = _successors.find_from_end(pred)) >= 0) { + while ((idx = _successors.find(pred)) >= 0) { _successors.remove_at(idx); } } @@ -677,7 +677,7 @@ void BlockBegin::remove_predecessor(BlockBegin* pred) { int idx; - while ((idx = _predecessors.find_from_end(pred)) >= 0) { + while ((idx = _predecessors.find(pred)) >= 0) { _predecessors.remove_at(idx); } } diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -5540,7 +5540,7 @@ 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); } @@ -6211,7 +6211,7 @@ _original_preds.clear(); for (j = block->number_of_preds() - 1; j >= 0; j--) { BlockBegin* pred = block->pred_at(j); - if (_original_preds.find_from_end(pred) == -1) { + if (_original_preds.find(pred) == -1) { _original_preds.append(pred); } } @@ -6378,19 +6378,19 @@ LIR_OpBranch* op_branch = instructions->at(j)->as_OpBranch(); if (op_branch != NULL) { - assert(op_branch->block() == NULL || code->find_from_end(op_branch->block()) != -1, "branch target not valid"); - assert(op_branch->ublock() == NULL || code->find_from_end(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->find_from_end(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->find_from_end(pred) != -1, "successor not valid"); + assert(code->find(pred) != -1, "successor not valid"); } } } # HG changeset patch # User fzhinkin # Date 1459431778 -10800 # Thu Mar 31 16:42:58 2016 +0300 # Node ID 598e84afe8228a7bfe05cca084ce536b4d53e466 # Parent 759219519a441e95a97e3f09a11654dd6e102a37 imported patch primitive arrays diff --git a/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp b/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp --- a/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp +++ b/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp @@ -169,18 +169,18 @@ intArray* FpuStackSim::write_state() { intArray* res = new intArray(1 + FrameMap::nof_fpu_regs); - (*res)[0] = stack_size(); + res->append(stack_size()); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { - (*res)[1 + i] = regs_at(i); + res->append(regs_at(i)); } return res; } void FpuStackSim::read_state(intArray* fpu_stack_state) { - _stack_size = (*fpu_stack_state)[0]; + _stack_size = fpu_stack_state->at(0); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { - set_regs_at(i, (*fpu_stack_state)[1 + i]); + set_regs_at(i, fpu_stack_state->at(1 + i)); } } diff --git a/src/share/vm/c1/c1_FrameMap.cpp b/src/share/vm/c1/c1_FrameMap.cpp --- a/src/share/vm/c1/c1_FrameMap.cpp +++ b/src/share/vm/c1/c1_FrameMap.cpp @@ -164,7 +164,7 @@ _reserved_argument_area_size = MAX2(4, reserved_argument_area_size) * BytesPerWord; _argcount = method->arg_size(); - _argument_locations = new intArray(_argcount, -1); + _argument_locations = new intArray(_argcount, _argcount, -1); _incoming_arguments = java_calling_convention(signature_type_array_for(method), false); _oop_map_arg_count = _incoming_arguments->reserved_stack_slots(); diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -356,7 +356,7 @@ _active = BitMap(BlockBegin::number_of_blocks()); _active.clear(); _visited = BitMap(BlockBegin::number_of_blocks()); _visited.clear(); - _loop_map = intArray(BlockBegin::number_of_blocks(), 0); + _loop_map = intArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), 0); _next_loop_index = 0; _next_block_number = _blocks.length(); @@ -1353,7 +1353,7 @@ } else { // collect successors & keys BlockList* sux = new BlockList(l + 1, NULL); - intArray* keys = new intArray(l, 0); + intArray* keys = new intArray(l, l, 0); int i; bool has_bb = false; for (i = 0; i < l; i++) { diff --git a/src/share/vm/c1/c1_IR.cpp b/src/share/vm/c1/c1_IR.cpp --- a/src/share/vm/c1/c1_IR.cpp +++ b/src/share/vm/c1/c1_IR.cpp @@ -530,7 +530,7 @@ _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 diff --git a/src/share/vm/c1/c1_Instruction.cpp b/src/share/vm/c1/c1_Instruction.cpp --- a/src/share/vm/c1/c1_Instruction.cpp +++ b/src/share/vm/c1/c1_Instruction.cpp @@ -722,13 +722,15 @@ void BlockBegin::iterate_preorder(BlockClosure* closure) { - boolArray mark(number_of_blocks(), false); + int mark_len = number_of_blocks(); + boolArray mark(mark_len, mark_len, false); iterate_preorder(mark, closure); } void BlockBegin::iterate_postorder(BlockClosure* closure) { - boolArray mark(number_of_blocks(), false); + int mark_len = number_of_blocks(); + boolArray mark(mark_len, mark_len, false); iterate_postorder(mark, closure); } diff --git a/src/share/vm/c1/c1_LinearScan.hpp b/src/share/vm/c1/c1_LinearScan.hpp --- a/src/share/vm/c1/c1_LinearScan.hpp +++ b/src/share/vm/c1/c1_LinearScan.hpp @@ -607,7 +607,7 @@ void add_range(int from, int to); Interval* split(int split_pos); Interval* split_from_start(int split_pos); - void remove_first_use_pos() { _use_pos_and_kinds.truncate(_use_pos_and_kinds.length() - 2); } + void remove_first_use_pos() { _use_pos_and_kinds.trunc_to(_use_pos_and_kinds.length() - 2); } // test intersection bool covers(int op_id, LIR_OpVisitState::OprMode mode) const; diff --git a/src/share/vm/c1/c1_Optimizer.cpp b/src/share/vm/c1/c1_Optimizer.cpp --- a/src/share/vm/c1/c1_Optimizer.cpp +++ b/src/share/vm/c1/c1_Optimizer.cpp @@ -1162,19 +1162,19 @@ // handlers and iterate over them as well int nblocks = BlockBegin::number_of_blocks(); BlockList blocks(nblocks); - boolArray visited_block(nblocks, false); + boolArray visited_block(nblocks, nblocks, false); blocks.push(ir()->start()); - visited_block[ir()->start()->block_id()] = true; + visited_block.at_put(ir()->start()->block_id(), true); for (int i = 0; i < blocks.length(); i++) { BlockBegin* b = blocks.at(i); // exception handlers need to be treated as additional roots for (int e = b->number_of_exception_handlers(); e-- > 0; ) { BlockBegin* excp = b->exception_handler_at(e); int id = excp->block_id(); - if (!visited_block[id]) { + if (!visited_block.at(id)) { blocks.push(excp); - visited_block[id] = true; + visited_block.at_put(id, true); nce.iterate(excp); } } @@ -1183,9 +1183,9 @@ for (int s = end->number_of_sux(); s-- > 0; ) { BlockBegin* next = end->sux_at(s); int id = next->block_id(); - if (!visited_block[id]) { + if (!visited_block.at(id)) { blocks.push(next); - visited_block[id] = true; + visited_block.at_put(id, true); } } } diff --git a/src/share/vm/c1/c1_RangeCheckElimination.cpp b/src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -1051,7 +1051,7 @@ #endif // Verification or the IR -RangeCheckEliminator::Verification::Verification(IR *ir) : _used(BlockBegin::number_of_blocks(), false) { +RangeCheckEliminator::Verification::Verification(IR *ir) : _used(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), false) { this->_ir = ir; ir->iterate_linear_scan_order(this); } @@ -1146,14 +1146,14 @@ if (start == end) return start != dont_use; // Simple BSF from start to end // BlockBeginList _current; - for (int i=0; i<_used.length(); i++) { - _used[i] = false; + for (int i=0; i < _used.length(); i++) { + _used.at_put(i, false); } _current.trunc_to(0); _successors.trunc_to(0); if (start != dont_use) { _current.push(start); - _used[start->block_id()] = true; + _used.at_put(start->block_id(), true); } // BlockBeginList _successors; @@ -1185,8 +1185,8 @@ if (sux == end) { return true; } - if (sux != dont_use && !_used[sux->block_id()]) { - _used[sux->block_id()] = true; + if (sux != dont_use && !_used.at(sux->block_id())) { + _used.at_put(sux->block_id(), true); _current.push(sux); } } diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -2927,7 +2927,7 @@ // If JVMTI original method ordering or sharing is enabled construct int // array remembering the original ordering if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { - method_ordering = new intArray(length); + method_ordering = new intArray(length, length, -1); for (int index = 0; index < length; index++) { Method* const m = methods->at(index); const int old_index = m->vtable_index(); diff --git a/src/share/vm/classfile/classFileParser.hpp b/src/share/vm/classfile/classFileParser.hpp --- a/src/share/vm/classfile/classFileParser.hpp +++ b/src/share/vm/classfile/classFileParser.hpp @@ -42,7 +42,6 @@ template class GrowableArray; class InstanceKlass; -class intArray; class Symbol; class TempNewSymbol; diff --git a/src/share/vm/interpreter/rewriter.cpp b/src/share/vm/interpreter/rewriter.cpp --- a/src/share/vm/interpreter/rewriter.cpp +++ b/src/share/vm/interpreter/rewriter.cpp @@ -65,11 +65,12 @@ // Record limits of resolved reference map for constant pool cache indices record_map_limits(); - guarantee((int)_cp_cache_map.length()-1 <= (int)((u2)-1), + guarantee((int) _cp_cache_map.length() - 1 <= (int) ((u2)-1), "all cp cache indexes fit in a u2"); - if (saw_mh_symbol) - _method_handle_invokers.initialize(length, (int)0); + if (saw_mh_symbol) { + _method_handle_invokers.at_grow(length, 0); + } } // Unrewrite the bytecodes if an error occurs. @@ -193,7 +194,7 @@ assert(_pool->tag_at(cp_index).is_method(), "wrong index"); // Determine whether this is a signature-polymorphic method. if (cp_index >= _method_handle_invokers.length()) return; - int status = _method_handle_invokers[cp_index]; + int status = _method_handle_invokers.at(cp_index); assert(status >= -1 && status <= 1, "oob tri-state"); if (status == 0) { if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_MethodHandle() && @@ -211,7 +212,7 @@ } else { status = -1; } - _method_handle_invokers[cp_index] = status; + _method_handle_invokers.at(cp_index) = status; } // We use a special internal bytecode for such methods (if non-static). // The basic reason for this is that such methods need an extra "appendix" argument @@ -287,7 +288,7 @@ // add delta to each. int resolved_index = _patch_invokedynamic_refs->at(i); for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { - assert(_invokedynamic_references_map[resolved_index+entry] == cache_index, + assert(_invokedynamic_references_map.at(resolved_index + entry) == cache_index, "should be the same index"); _invokedynamic_references_map.at_put(resolved_index+entry, cache_index + delta); @@ -520,7 +521,14 @@ Rewriter::Rewriter(instanceKlassHandle klass, const constantPoolHandle& cpool, Array* methods, TRAPS) : _klass(klass), _pool(cpool), - _methods(methods) + _methods(methods), + _cp_map(cpool->length()), + _cp_cache_map(cpool->length() / 2), + _reference_map(cpool->length()), + _resolved_references_map(cpool->length() / 2), + _invokedynamic_references_map(cpool->length() / 2), + _method_handle_invokers(cpool->length()), + _invokedynamic_cp_cache_map(cpool->length() / 4) { // Rewrite bytecodes - exception here exits. diff --git a/src/share/vm/interpreter/rewriter.hpp b/src/share/vm/interpreter/rewriter.hpp --- a/src/share/vm/interpreter/rewriter.hpp +++ b/src/share/vm/interpreter/rewriter.hpp @@ -37,13 +37,13 @@ instanceKlassHandle _klass; constantPoolHandle _pool; Array* _methods; - intArray _cp_map; - intStack _cp_cache_map; // for Methodref, Fieldref, - // InterfaceMethodref and InvokeDynamic - intArray _reference_map; // maps from cp index to resolved_refs index (or -1) - intStack _resolved_references_map; // for strings, methodHandle, methodType - intStack _invokedynamic_references_map; // for invokedynamic resolved refs - intArray _method_handle_invokers; + GrowableArray _cp_map; + GrowableArray _cp_cache_map; // for Methodref, Fieldref, + // InterfaceMethodref and InvokeDynamic + GrowableArray _reference_map; // maps from cp index to resolved_refs index (or -1) + GrowableArray _resolved_references_map; // for strings, methodHandle, methodType + GrowableArray _invokedynamic_references_map; // for invokedynamic resolved refs + GrowableArray _method_handle_invokers; int _resolved_reference_limit; // For mapping invokedynamic bytecodes, which are discovered during method @@ -51,28 +51,31 @@ // If there are any invokespecial/InterfaceMethodref special case bytecodes, // these entries are added before invokedynamic entries so that the // invokespecial bytecode 16 bit index doesn't overflow. - intStack _invokedynamic_cp_cache_map; + GrowableArray _invokedynamic_cp_cache_map; // For patching. GrowableArray
* _patch_invokedynamic_bcps; GrowableArray* _patch_invokedynamic_refs; void init_maps(int length) { - _cp_map.initialize(length, -1); - // Choose an initial value large enough that we don't get frequent - // calls to grow(). - _cp_cache_map.initialize(length/2); + _cp_map.trunc_to(0); + _cp_map.at_grow(length, -1); + + _cp_cache_map.trunc_to(0); // Also cache resolved objects, in another different cache. - _reference_map.initialize(length, -1); - _resolved_references_map.initialize(length/2); - _invokedynamic_references_map.initialize(length/2); + _reference_map.trunc_to(0); + _reference_map.at_grow(length, -1); + + _method_handle_invokers.trunc_to(0); + _resolved_references_map.trunc_to(0); + _invokedynamic_references_map.trunc_to(0); _resolved_reference_limit = -1; _first_iteration_cp_cache_limit = -1; // invokedynamic specific fields - _invokedynamic_cp_cache_map.initialize(length/4); - _patch_invokedynamic_bcps = new GrowableArray
(length/4); - _patch_invokedynamic_refs = new GrowableArray(length/4); + _invokedynamic_cp_cache_map.trunc_to(0); + _patch_invokedynamic_bcps = new GrowableArray
(length / 4); + _patch_invokedynamic_refs = new GrowableArray(length / 4); } int _first_iteration_cp_cache_limit; @@ -90,10 +93,10 @@ return _cp_cache_map.length() - _first_iteration_cp_cache_limit; } - int cp_entry_to_cp_cache(int i) { assert(has_cp_cache(i), "oob"); return _cp_map[i]; } - bool has_cp_cache(int i) { return (uint)i < (uint)_cp_map.length() && _cp_map[i] >= 0; } + int cp_entry_to_cp_cache(int i) { assert(has_cp_cache(i), "oob"); return _cp_map.at(i); } + bool has_cp_cache(int i) { return (uint) i < (uint) _cp_map.length() && _cp_map.at(i) >= 0; } - int add_map_entry(int cp_index, intArray* cp_map, intStack* cp_cache_map) { + int add_map_entry(int cp_index, GrowableArray* cp_map, GrowableArray* cp_cache_map) { assert(cp_map->at(cp_index) == -1, "not twice on same cp_index"); int cache_index = cp_cache_map->append(cp_index); cp_map->at_put(cp_index, cache_index); @@ -121,7 +124,7 @@ } int invokedynamic_cp_cache_entry_pool_index(int cache_index) { - int cp_index = _invokedynamic_cp_cache_map[cache_index]; + int cp_index = _invokedynamic_cp_cache_map.at(cache_index); return cp_index; } @@ -131,9 +134,9 @@ assert(_first_iteration_cp_cache_limit >= 0, "add these special cache entries after first iteration"); // Don't add InterfaceMethodref if it already exists at the end. for (int i = _first_iteration_cp_cache_limit; i < _cp_cache_map.length(); i++) { - if (cp_cache_entry_pool_index(i) == cp_index) { - return i; - } + if (cp_cache_entry_pool_index(i) == cp_index) { + return i; + } } int cache_index = _cp_cache_map.append(cp_index); assert(cache_index >= _first_iteration_cp_cache_limit, ""); @@ -144,10 +147,10 @@ int cp_entry_to_resolved_references(int cp_index) const { assert(has_entry_in_resolved_references(cp_index), "oob"); - return _reference_map[cp_index]; + return _reference_map.at(cp_index); } bool has_entry_in_resolved_references(int cp_index) const { - return (uint)cp_index < (uint)_reference_map.length() && _reference_map[cp_index] >= 0; + return (uint) cp_index < (uint) _reference_map.length() && _reference_map.at(cp_index) >= 0; } // add a new entry to the resolved_references map @@ -174,13 +177,13 @@ } int resolved_references_entry_to_pool_index(int ref_index) { - int cp_index = _resolved_references_map[ref_index]; + int cp_index = _resolved_references_map.at(ref_index); return cp_index; } // Access the contents of _cp_cache_map to determine CP cache layout. int cp_cache_entry_pool_index(int cache_index) { - int cp_index = _cp_cache_map[cache_index]; + int cp_index = _cp_cache_map.at(cache_index); return cp_index; } diff --git a/src/share/vm/oops/cpCache.cpp b/src/share/vm/oops/cpCache.cpp --- a/src/share/vm/oops/cpCache.cpp +++ b/src/share/vm/oops/cpCache.cpp @@ -568,7 +568,7 @@ const intArray& invokedynamic_references_map) { for (int i = 0; i < inverse_index_map.length(); i++) { ConstantPoolCacheEntry* e = entry_at(i); - int original_index = inverse_index_map[i]; + int original_index = inverse_index_map.at(i); e->initialize_entry(original_index); assert(entry_at(i) == e, "sanity"); } @@ -578,19 +578,19 @@ for (int i = 0; i < invokedynamic_inverse_index_map.length(); i++) { int offset = i + invokedynamic_offset; ConstantPoolCacheEntry* e = entry_at(offset); - int original_index = invokedynamic_inverse_index_map[i]; + int original_index = invokedynamic_inverse_index_map.at(i); e->initialize_entry(original_index); assert(entry_at(offset) == e, "sanity"); } for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { - const int cpci = invokedynamic_references_map[ref]; + const int cpci = invokedynamic_references_map.at(ref); if (cpci >= 0) { #ifdef ASSERT // invokedynamic and invokehandle have more entries; check if they // all point to the same constant pool cache entry. for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { - const int cpci_next = invokedynamic_references_map[ref + entry]; + const int cpci_next = invokedynamic_references_map.at(ref + entry); assert(cpci == cpci_next, "%d == %d", cpci, cpci_next); } #endif diff --git a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp --- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -693,7 +693,7 @@ if (JvmtiExport::can_maintain_original_method_order()) { int index; int original_index; - intArray method_order(num_methods, 0); + intArray method_order(num_methods, num_methods, 0); // invert the method order mapping for (index = 0; index < num_methods; index++) { diff --git a/src/share/vm/prims/jvmtiRedefineClasses.cpp b/src/share/vm/prims/jvmtiRedefineClasses.cpp --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -1447,12 +1447,12 @@ ResourceMark rm(THREAD); _index_map_count = 0; - _index_map_p = new intArray(scratch_cp->length(), -1); + _index_map_p = new intArray(scratch_cp->length(), scratch_cp->length(), -1); _operands_cur_length = ConstantPool::operand_array_length(old_cp->operands()); _operands_index_map_count = 0; - _operands_index_map_p = new intArray( - ConstantPool::operand_array_length(scratch_cp->operands()), -1); + int operands_index_map_len = ConstantPool::operand_array_length(scratch_cp->operands()); + _operands_index_map_p = new intArray(operands_index_map_len, operands_index_map_len, -1); // reference to the cp holder is needed for copy_operands() merge_cp->set_pool_holder(scratch_class()); diff --git a/src/share/vm/utilities/array.hpp b/src/share/vm/utilities/array.hpp --- a/src/share/vm/utilities/array.hpp +++ b/src/share/vm/utilities/array.hpp @@ -292,12 +292,7 @@ define_generic_array(element_type##Array, element_type *, CHeapArray) \ define_stack(element_type##List, element_type##Array) - // Arrays for basic types - -define_array(boolArray, bool) define_stack(boolStack, boolArray) -define_array(intArray , int ) define_stack(intStack , intArray ) - // Array for metadata allocation template # HG changeset patch # User fzhinkin # Date 1459431784 -10800 # Thu Mar 31 16:43:04 2016 +0300 # Node ID 9bd6f3d09b5c6d418a8afce4449edb565758c990 # Parent 598e84afe8228a7bfe05cca084ce536b4d53e466 imported patch update dates diff --git a/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp --- a/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +++ b/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp b/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp --- a/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp +++ b/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp b/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp --- a/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp +++ b/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/src/share/vm/c1/c1_CodeStubs.hpp b/src/share/vm/c1/c1_CodeStubs.hpp --- a/src/share/vm/c1/c1_CodeStubs.hpp +++ b/src/share/vm/c1/c1_CodeStubs.hpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_Compilation.hpp b/src/share/vm/c1/c1_Compilation.hpp --- a/src/share/vm/c1/c1_Compilation.hpp +++ b/src/share/vm/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 diff --git a/src/share/vm/c1/c1_FrameMap.cpp b/src/share/vm/c1/c1_FrameMap.cpp --- a/src/share/vm/c1/c1_FrameMap.cpp +++ b/src/share/vm/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/src/share/vm/c1/c1_FrameMap.hpp b/src/share/vm/c1/c1_FrameMap.hpp --- a/src/share/vm/c1/c1_FrameMap.hpp +++ b/src/share/vm/c1/c1_FrameMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_IR.cpp b/src/share/vm/c1/c1_IR.cpp --- a/src/share/vm/c1/c1_IR.cpp +++ b/src/share/vm/c1/c1_IR.cpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_IR.hpp b/src/share/vm/c1/c1_IR.hpp --- a/src/share/vm/c1/c1_IR.hpp +++ b/src/share/vm/c1/c1_IR.hpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_Instruction.cpp b/src/share/vm/c1/c1_Instruction.cpp --- a/src/share/vm/c1/c1_Instruction.cpp +++ b/src/share/vm/c1/c1_Instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 diff --git a/src/share/vm/c1/c1_Instruction.hpp b/src/share/vm/c1/c1_Instruction.hpp --- a/src/share/vm/c1/c1_Instruction.hpp +++ b/src/share/vm/c1/c1_Instruction.hpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_LIR.hpp b/src/share/vm/c1/c1_LIR.hpp --- a/src/share/vm/c1/c1_LIR.hpp +++ b/src/share/vm/c1/c1_LIR.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/src/share/vm/c1/c1_LIRAssembler.cpp b/src/share/vm/c1/c1_LIRAssembler.cpp --- a/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/src/share/vm/c1/c1_LIRGenerator.hpp b/src/share/vm/c1/c1_LIRGenerator.hpp --- a/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/src/share/vm/c1/c1_LIRGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/src/share/vm/c1/c1_Optimizer.cpp b/src/share/vm/c1/c1_Optimizer.cpp --- a/src/share/vm/c1/c1_Optimizer.cpp +++ b/src/share/vm/c1/c1_Optimizer.cpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_RangeCheckElimination.cpp b/src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/src/share/vm/c1/c1_RangeCheckElimination.hpp b/src/share/vm/c1/c1_RangeCheckElimination.hpp --- a/src/share/vm/c1/c1_RangeCheckElimination.hpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/src/share/vm/c1/c1_ValueMap.cpp b/src/share/vm/c1/c1_ValueMap.cpp --- a/src/share/vm/c1/c1_ValueMap.cpp +++ b/src/share/vm/c1/c1_ValueMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 diff --git a/src/share/vm/c1/c1_ValueMap.hpp b/src/share/vm/c1/c1_ValueMap.hpp --- a/src/share/vm/c1/c1_ValueMap.hpp +++ b/src/share/vm/c1/c1_ValueMap.hpp @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/share/vm/c1/c1_ValueStack.cpp b/src/share/vm/c1/c1_ValueStack.cpp --- a/src/share/vm/c1/c1_ValueStack.cpp +++ b/src/share/vm/c1/c1_ValueStack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 diff --git a/src/share/vm/classfile/classFileParser.hpp b/src/share/vm/classfile/classFileParser.hpp --- a/src/share/vm/classfile/classFileParser.hpp +++ b/src/share/vm/classfile/classFileParser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 diff --git a/src/share/vm/interpreter/rewriter.cpp b/src/share/vm/interpreter/rewriter.cpp --- a/src/share/vm/interpreter/rewriter.cpp +++ b/src/share/vm/interpreter/rewriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp --- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/src/share/vm/utilities/array.hpp b/src/share/vm/utilities/array.hpp --- a/src/share/vm/utilities/array.hpp +++ b/src/share/vm/utilities/array.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 # HG changeset patch # User fzhinkin # Date 1459431791 -10800 # Thu Mar 31 16:43:11 2016 +0300 # Node ID dfe630bc92b6398a480ddb1486a05b2db11e2d45 # Parent 9bd6f3d09b5c6d418a8afce4449edb565758c990 imported patch remove commented lines diff --git a/src/share/vm/c1/c1_FrameMap.hpp b/src/share/vm/c1/c1_FrameMap.hpp --- a/src/share/vm/c1/c1_FrameMap.hpp +++ b/src/share/vm/c1/c1_FrameMap.hpp @@ -36,8 +36,6 @@ class ciMethod; class CallingConvention; -//class BasicTypeArray; -//class BasicTypeList; //-------------------------------------------------------- // FrameMap # HG changeset patch # User fzhinkin # Date 1459431798 -10800 # Thu Mar 31 16:43:18 2016 +0300 # Node ID f0d535ae84f6150c2065b50dd836f44ec7d3ccbe # Parent dfe630bc92b6398a480ddb1486a05b2db11e2d45 imported patch move some typedef back diff --git a/src/share/vm/utilities/array.hpp b/src/share/vm/utilities/array.hpp --- a/src/share/vm/utilities/array.hpp +++ b/src/share/vm/utilities/array.hpp @@ -293,6 +293,11 @@ define_stack(element_type##List, element_type##Array) // Arrays for basic types +typedef GrowableArray intArray; +typedef GrowableArray intStack; +typedef GrowableArray boolArray; +typedef GrowableArray boolStack; + // Array for metadata allocation template # HG changeset patch # User fzhinkin # Date 1459431804 -10800 # Thu Mar 31 16:43:24 2016 +0300 # Node ID 3061c6891ba6a5eddf5fc0a385cae6377d013608 # Parent f0d535ae84f6150c2065b50dd836f44ec7d3ccbe imported patch ParNewThreadStateSet diff --git a/src/share/vm/gc/cms/parNewGeneration.cpp b/src/share/vm/gc/cms/parNewGeneration.cpp --- a/src/share/vm/gc/cms/parNewGeneration.cpp +++ b/src/share/vm/gc/cms/parNewGeneration.cpp @@ -280,7 +280,7 @@ } } -class ParScanThreadStateSet: private ResourceArray { +class ParScanThreadStateSet: private GenericGrowableArray { public: // Initializes states for the specified number of threads; ParScanThreadStateSet(int num_threads, @@ -315,6 +315,8 @@ ParallelTaskTerminator& _term; ParNewGeneration& _young_gen; Generation& _old_gen; + ParScanThreadState* _data; + int length() const { return _len; }; public: bool is_valid(int id) const { return id < length(); } ParallelTaskTerminator* terminator() { return &_term; } @@ -329,7 +331,7 @@ PreservedMarksSet& preserved_marks_set, size_t desired_plab_sz, ParallelTaskTerminator& term) - : ResourceArray(sizeof(ParScanThreadState), num_threads), +: GenericGrowableArray(num_threads, num_threads, false, mtInternal), _young_gen(young_gen), _old_gen(old_gen), _term(term) @@ -338,17 +340,18 @@ assert(ParGCUseLocalOverflow == (overflow_stacks != NULL), "overflow_stack allocation mismatch"); // Initialize states. + _data = (ParScanThreadState*) raw_allocate(sizeof(ParScanThreadState)); for (int i = 0; i < num_threads; ++i) { - new ((ParScanThreadState*)_data + i) - ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set, - overflow_stacks, preserved_marks_set.get(i), - desired_plab_sz, term); + ::new((void*) &_data[i]) + ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set, + overflow_stacks, preserved_marks_set.get(i), + desired_plab_sz, term); } } inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i) { assert(i >= 0 && i < length(), "sanity check!"); - return ((ParScanThreadState*)_data)[i]; + return _data[i]; } void ParScanThreadStateSet::trace_promotion_failed(const YoungGCTracer* gc_tracer) {