src/share/vm/opto/compile.cpp

changeset 3971
6c5b7a6becc8
parent 3882
8c92982cbbc4
child 4006
5af51c882207
equal deleted inserted replaced
3970:977007096840 3971:6c5b7a6becc8
3136 break; 3136 break;
3137 } 3137 }
3138 default: ShouldNotReachHere(); 3138 default: ShouldNotReachHere();
3139 } 3139 }
3140 assert(constant_addr, "consts section too small"); 3140 assert(constant_addr, "consts section too small");
3141 assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset())); 3141 assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset()));
3142 } 3142 }
3143 } 3143 }
3144 3144
3145 int Compile::ConstantTable::find_offset(Constant& con) const { 3145 int Compile::ConstantTable::find_offset(Constant& con) const {
3146 int idx = _constants.find(con); 3146 int idx = _constants.find(con);
3197 void Compile::ConstantTable::fill_jump_table(CodeBuffer& cb, MachConstantNode* n, GrowableArray<Label*> labels) const { 3197 void Compile::ConstantTable::fill_jump_table(CodeBuffer& cb, MachConstantNode* n, GrowableArray<Label*> labels) const {
3198 // If called from Compile::scratch_emit_size do nothing. 3198 // If called from Compile::scratch_emit_size do nothing.
3199 if (Compile::current()->in_scratch_emit_size()) return; 3199 if (Compile::current()->in_scratch_emit_size()) return;
3200 3200
3201 assert(labels.is_nonempty(), "must be"); 3201 assert(labels.is_nonempty(), "must be");
3202 assert((uint) labels.length() == n->outcnt(), err_msg("must be equal: %d == %d", labels.length(), n->outcnt())); 3202 assert((uint) labels.length() == n->outcnt(), err_msg_res("must be equal: %d == %d", labels.length(), n->outcnt()));
3203 3203
3204 // Since MachConstantNode::constant_offset() also contains 3204 // Since MachConstantNode::constant_offset() also contains
3205 // table_base_offset() we need to subtract the table_base_offset() 3205 // table_base_offset() we need to subtract the table_base_offset()
3206 // to get the plain offset into the constant table. 3206 // to get the plain offset into the constant table.
3207 int offset = n->constant_offset() - table_base_offset(); 3207 int offset = n->constant_offset() - table_base_offset();
3209 MacroAssembler _masm(&cb); 3209 MacroAssembler _masm(&cb);
3210 address* jump_table_base = (address*) (_masm.code()->consts()->start() + offset); 3210 address* jump_table_base = (address*) (_masm.code()->consts()->start() + offset);
3211 3211
3212 for (uint i = 0; i < n->outcnt(); i++) { 3212 for (uint i = 0; i < n->outcnt(); i++) {
3213 address* constant_addr = &jump_table_base[i]; 3213 address* constant_addr = &jump_table_base[i];
3214 assert(*constant_addr == (((address) n) + i), err_msg("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i))); 3214 assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i)));
3215 *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); 3215 *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr);
3216 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); 3216 cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
3217 } 3217 }
3218 } 3218 }

mercurial