提交 da71dc0c 编写于 作者: N never

Merge

......@@ -274,10 +274,10 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
// hc_klass is a HotSpot magic field and hence we can't
// find it from InstanceKlass for java.lang.Class.
TypeDataBase db = VM.getVM().getTypeDataBase();
int hcKlassOffset = (int) Oop.getHeaderSize();
int hcKlassOffset = (int) Instance.getHeaderSize();
try {
hcKlassOffset += (db.lookupIntConstant("java_lang_Class::hc_klass_offset").intValue() *
db.getAddressSize());
VM.getVM().getHeapOopSize());
} catch (RuntimeException re) {
// ignore, currently java_lang_Class::hc_klass_offset is zero
}
......
......@@ -5975,7 +5975,8 @@ instruct encodeHeapOop_not_null(iRegN dst, iRegP src) %{
%}
instruct decodeHeapOop(iRegP dst, iRegN src) %{
predicate(n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull);
predicate(n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant);
match(Set dst (DecodeN src));
format %{ "decode_heap_oop $src, $dst" %}
ins_encode %{
......@@ -5985,7 +5986,8 @@ instruct decodeHeapOop(iRegP dst, iRegN src) %{
%}
instruct decodeHeapOop_not_null(iRegP dst, iRegN src) %{
predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull);
predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant);
match(Set dst (DecodeN src));
format %{ "decode_heap_oop_not_null $src, $dst" %}
ins_encode %{
......@@ -6677,10 +6679,9 @@ instruct compareAndSwapP_bool(iRegP mem_ptr, iRegP oldval, iRegP newval, iRegI r
ins_pipe( long_memory_op );
%}
instruct compareAndSwapN_bool_comp(iRegP mem_ptr, iRegN oldval, iRegN newval, iRegI res, o7RegI tmp, flagsReg ccr ) %{
instruct compareAndSwapN_bool(iRegP mem_ptr, iRegN oldval, iRegN newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{
match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
effect( USE mem_ptr, KILL ccr, KILL tmp);
effect( USE mem_ptr, KILL ccr, KILL tmp1);
format %{
"MOV $newval,O7\n\t"
"CASA [$mem_ptr],$oldval,O7\t! If $oldval==[$mem_ptr] Then store O7 into [$mem_ptr], set O7=[$mem_ptr] in any case\n\t"
......@@ -6688,18 +6689,8 @@ instruct compareAndSwapN_bool_comp(iRegP mem_ptr, iRegN oldval, iRegN newval, iR
"MOV 1,$res\n\t"
"MOVne icc,R_G0,$res"
%}
ins_encode %{
Register Rmem = reg_to_register_object($mem_ptr$$reg);
Register Rold = reg_to_register_object($oldval$$reg);
Register Rnew = reg_to_register_object($newval$$reg);
Register Rres = reg_to_register_object($res$$reg);
__ cas(Rmem, Rold, Rnew);
__ cmp( Rold, Rnew );
__ mov(1, Rres);
__ movcc( Assembler::notEqual, false, Assembler::icc, G0, Rres );
%}
ins_encode( enc_casi(mem_ptr, oldval, newval),
enc_iflags_ne_to_boolean(res) );
ins_pipe( long_memory_op );
%}
......
......@@ -5007,8 +5007,7 @@ int MacroAssembler::biased_locking_enter(Register lock_reg, Register obj_reg, Re
jcc(Assembler::notEqual, cas_label);
// The bias pattern is present in the object's header. Need to check
// whether the bias owner and the epoch are both still current.
load_klass(tmp_reg, obj_reg);
movq(tmp_reg, Address(tmp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()));
load_prototype_header(tmp_reg, obj_reg);
orq(tmp_reg, r15_thread);
xorq(tmp_reg, swap_reg);
andq(tmp_reg, ~((int) markOopDesc::age_mask_in_place));
......@@ -5082,8 +5081,7 @@ int MacroAssembler::biased_locking_enter(Register lock_reg, Register obj_reg, Re
//
// FIXME: due to a lack of registers we currently blow away the age
// bits in this situation. Should attempt to preserve them.
load_klass(tmp_reg, obj_reg);
movq(tmp_reg, Address(tmp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()));
load_prototype_header(tmp_reg, obj_reg);
orq(tmp_reg, r15_thread);
if (os::is_MP()) {
lock();
......@@ -5113,8 +5111,7 @@ int MacroAssembler::biased_locking_enter(Register lock_reg, Register obj_reg, Re
//
// FIXME: due to a lack of registers we currently blow away the age
// bits in this situation. Should attempt to preserve them.
load_klass(tmp_reg, obj_reg);
movq(tmp_reg, Address(tmp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()));
load_prototype_header(tmp_reg, obj_reg);
if (os::is_MP()) {
lock();
}
......@@ -5158,6 +5155,16 @@ void MacroAssembler::load_klass(Register dst, Register src) {
}
}
void MacroAssembler::load_prototype_header(Register dst, Register src) {
if (UseCompressedOops) {
movl(dst, Address(src, oopDesc::klass_offset_in_bytes()));
movq(dst, Address(r12_heapbase, dst, Address::times_8, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()));
} else {
movq(dst, Address(src, oopDesc::klass_offset_in_bytes()));
movq(dst, Address(dst, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()));
}
}
void MacroAssembler::store_klass(Register dst, Register src) {
if (UseCompressedOops) {
encode_heap_oop_not_null(src);
......
......@@ -1111,6 +1111,8 @@ class MacroAssembler : public Assembler {
void store_klass(Register dst, Register src);
void store_klass_gap(Register dst, Register src);
void load_prototype_header(Register dst, Register src);
void load_heap_oop(Register dst, Address src);
void store_heap_oop(Address dst, Register src);
void encode_heap_oop(Register r);
......
......@@ -6149,7 +6149,7 @@ instruct loadNKlass(rRegN dst, memory mem)
match(Set dst (LoadNKlass mem));
ins_cost(125); // XXX
format %{ "movl $dst, $mem\t# compressed klass ptr\n\t" %}
format %{ "movl $dst, $mem\t# compressed klass ptr" %}
ins_encode %{
Address addr = build_address($mem$$base, $mem$$index, $mem$$scale, $mem$$disp);
Register dst = as_Register($dst$$reg);
......@@ -7089,7 +7089,8 @@ instruct encodeHeapOop_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{
%}
instruct decodeHeapOop(rRegP dst, rRegN src, rFlagsReg cr) %{
predicate(n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull);
predicate(n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant);
match(Set dst (DecodeN src));
effect(KILL cr);
format %{ "decode_heap_oop $dst,$src" %}
......@@ -7105,7 +7106,8 @@ instruct decodeHeapOop(rRegP dst, rRegN src, rFlagsReg cr) %{
%}
instruct decodeHeapOop_not_null(rRegP dst, rRegN src) %{
predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull);
predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant);
match(Set dst (DecodeN src));
format %{ "decode_heap_oop_not_null $dst,$src" %}
ins_encode %{
......
......@@ -878,7 +878,7 @@ int ciMethod::instructions_size() {
(TieredCompilation && code->compiler() != NULL && code->compiler()->is_c1())) {
return 0;
}
return code->code_size();
return code->code_end() - code->verified_entry_point();
)
}
......
......@@ -1621,64 +1621,6 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (opt != NULL) return opt;
}
if (in(1) != NULL && in(1)->Opcode() == Op_AddP && can_reshape) {
// Try to undo Phi of AddP:
// (Phi (AddP base base y) (AddP base2 base2 y))
// becomes:
// newbase := (Phi base base2)
// (AddP newbase newbase y)
//
// This occurs as a result of unsuccessful split_thru_phi and
// interferes with taking advantage of addressing modes. See the
// clone_shift_expressions code in matcher.cpp
Node* addp = in(1);
const Type* type = addp->in(AddPNode::Base)->bottom_type();
Node* y = addp->in(AddPNode::Offset);
if (y != NULL && addp->in(AddPNode::Base) == addp->in(AddPNode::Address)) {
// make sure that all the inputs are similar to the first one,
// i.e. AddP with base == address and same offset as first AddP
bool doit = true;
for (uint i = 2; i < req(); i++) {
if (in(i) == NULL ||
in(i)->Opcode() != Op_AddP ||
in(i)->in(AddPNode::Base) != in(i)->in(AddPNode::Address) ||
in(i)->in(AddPNode::Offset) != y) {
doit = false;
break;
}
// Accumulate type for resulting Phi
type = type->meet(in(i)->in(AddPNode::Base)->bottom_type());
}
Node* base = NULL;
if (doit) {
// Check for neighboring AddP nodes in a tree.
// If they have a base, use that it.
for (DUIterator_Fast kmax, k = this->fast_outs(kmax); k < kmax; k++) {
Node* u = this->fast_out(k);
if (u->is_AddP()) {
Node* base2 = u->in(AddPNode::Base);
if (base2 != NULL && !base2->is_top()) {
if (base == NULL)
base = base2;
else if (base != base2)
{ doit = false; break; }
}
}
}
}
if (doit) {
if (base == NULL) {
base = new (phase->C, in(0)->req()) PhiNode(in(0), type, NULL);
for (uint i = 1; i < req(); i++) {
base->init_req(i, in(i)->in(AddPNode::Base));
}
phase->is_IterGVN()->register_new_node_with_optimizer(base);
}
return new (phase->C, 4) AddPNode(base, base, y);
}
}
}
// Split phis through memory merges, so that the memory merges will go away.
// Piggy-back this transformation on the search for a unique input....
// It will be as if the merged memory is the unique value of the phi.
......
......@@ -1992,11 +1992,49 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) {
}
case Op_AddP: { // Assert sane base pointers
const Node *addp = n->in(AddPNode::Address);
Node *addp = n->in(AddPNode::Address);
assert( !addp->is_AddP() ||
addp->in(AddPNode::Base)->is_top() || // Top OK for allocation
addp->in(AddPNode::Base) == n->in(AddPNode::Base),
"Base pointers must match" );
#ifdef _LP64
if (UseCompressedOops &&
addp->Opcode() == Op_ConP &&
addp == n->in(AddPNode::Base) &&
n->in(AddPNode::Offset)->is_Con()) {
// Use addressing with narrow klass to load with offset on x86.
// On sparc loading 32-bits constant and decoding it have less
// instructions (4) then load 64-bits constant (7).
// Do this transformation here since IGVN will convert ConN back to ConP.
const Type* t = addp->bottom_type();
if (t->isa_oopptr()) {
Node* nn = NULL;
// Look for existing ConN node of the same exact type.
Compile* C = Compile::current();
Node* r = C->root();
uint cnt = r->outcnt();
for (uint i = 0; i < cnt; i++) {
Node* m = r->raw_out(i);
if (m!= NULL && m->Opcode() == Op_ConN &&
m->bottom_type()->is_narrowoop()->make_oopptr() == t) {
nn = m;
break;
}
}
if (nn != NULL) {
// Decode a narrow oop to match address
// [R12 + narrow_oop_reg<<3 + offset]
nn = new (C, 2) DecodeNNode(nn, t);
n->set_req(AddPNode::Base, nn);
n->set_req(AddPNode::Address, nn);
if (addp->outcnt() == 0) {
addp->disconnect_inputs(NULL);
}
}
}
}
#endif
break;
}
......
......@@ -940,6 +940,7 @@ const Type *TypeD::xmeet( const Type *t ) const {
case InstPtr:
case KlassPtr:
case AryPtr:
case NarrowOop:
case Int:
case Long:
case FloatTop:
......@@ -1086,6 +1087,7 @@ const Type *TypeInt::xmeet( const Type *t ) const {
case InstPtr:
case KlassPtr:
case AryPtr:
case NarrowOop:
case Long:
case FloatTop:
case FloatCon:
......@@ -1093,7 +1095,6 @@ const Type *TypeInt::xmeet( const Type *t ) const {
case DoubleTop:
case DoubleCon:
case DoubleBot:
case NarrowOop:
case Bottom: // Ye Olde Default
return Type::BOTTOM;
default: // All else is a mistake
......@@ -1328,6 +1329,7 @@ const Type *TypeLong::xmeet( const Type *t ) const {
case InstPtr:
case KlassPtr:
case AryPtr:
case NarrowOop:
case Int:
case FloatTop:
case FloatCon:
......
......@@ -1176,7 +1176,9 @@ void Arguments::set_ergonomics_flags() {
// by ergonomics.
if (!UseConcMarkSweepGC && MaxHeapSize <= max_heap_for_compressed_oops()) {
if (FLAG_IS_DEFAULT(UseCompressedOops)) {
FLAG_SET_ERGO(bool, UseCompressedOops, true);
// Leave compressed oops off by default. Uncomment
// the following line to return it to default status.
// FLAG_SET_ERGO(bool, UseCompressedOops, true);
}
} else {
if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册