提交 a1b799a8 编写于 作者: N never

6818666: G1: Type lost in g1 pre-barrier

Reviewed-by: kvn
上级 3ef748a2
......@@ -1378,7 +1378,7 @@ void GraphKit::pre_barrier(Node* ctl,
Node* adr,
uint adr_idx,
Node *val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt) {
BarrierSet* bs = Universe::heap()->barrier_set();
set_control(ctl);
......@@ -1436,7 +1436,7 @@ Node* GraphKit::store_oop_to_object(Node* ctl,
Node* adr,
const TypePtr* adr_type,
Node *val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt) {
uint adr_idx = C->get_alias_index(adr_type);
Node* store;
......@@ -1451,7 +1451,7 @@ Node* GraphKit::store_oop_to_array(Node* ctl,
Node* adr,
const TypePtr* adr_type,
Node *val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt) {
uint adr_idx = C->get_alias_index(adr_type);
Node* store;
......@@ -1466,12 +1466,29 @@ Node* GraphKit::store_oop_to_unknown(Node* ctl,
Node* adr,
const TypePtr* adr_type,
Node *val,
const Type* val_type,
BasicType bt) {
uint adr_idx = C->get_alias_index(adr_type);
Node* store;
Compile::AliasType* at = C->alias_type(adr_type);
const TypeOopPtr* val_type = NULL;
if (adr_type->isa_instptr()) {
if (at->field() != NULL) {
// known field. This code is a copy of the do_put_xxx logic.
ciField* field = at->field();
if (!field->type()->is_loaded()) {
val_type = TypeInstPtr::BOTTOM;
} else {
val_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
}
}
} else if (adr_type->isa_aryptr()) {
val_type = adr_type->is_aryptr()->elem()->isa_oopptr();
}
if (val_type == NULL) {
val_type = TypeInstPtr::BOTTOM;
}
uint adr_idx = at->index();
pre_barrier(ctl, obj, adr, adr_idx, val, val_type, bt);
store = store_to_memory(control(), adr, val, bt, adr_idx);
Node* store = store_to_memory(control(), adr, val, bt, adr_idx);
post_barrier(control(), store, obj, adr, adr_idx, val, bt, true);
return store;
}
......@@ -3202,7 +3219,7 @@ void GraphKit::g1_write_barrier_pre(Node* obj,
Node* adr,
uint alias_idx,
Node* val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt) {
IdealKit ideal(gvn(), control(), merged_memory(), true);
#define __ ideal.
......
......@@ -454,7 +454,7 @@ class GraphKit : public Phase {
Node* adr, // actual adress to store val at
const TypePtr* adr_type,
Node* val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt);
Node* store_oop_to_array(Node* ctl,
......@@ -462,7 +462,7 @@ class GraphKit : public Phase {
Node* adr, // actual adress to store val at
const TypePtr* adr_type,
Node* val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt);
// Could be an array or object we don't know at compile time (unsafe ref.)
......@@ -471,12 +471,11 @@ class GraphKit : public Phase {
Node* adr, // actual adress to store val at
const TypePtr* adr_type,
Node* val,
const Type* val_type,
BasicType bt);
// For the few case where the barriers need special help
void pre_barrier(Node* ctl, Node* obj, Node* adr, uint adr_idx,
Node* val, const Type* val_type, BasicType bt);
Node* val, const TypeOopPtr* val_type, BasicType bt);
void post_barrier(Node* ctl, Node* store, Node* obj, Node* adr, uint adr_idx,
Node* val, BasicType bt, bool use_precise);
......@@ -599,7 +598,7 @@ class GraphKit : public Phase {
Node* adr,
uint alias_idx,
Node* val,
const Type* val_type,
const TypeOopPtr* val_type,
BasicType bt);
void g1_write_barrier_post(Node* store,
......
......@@ -2178,9 +2178,8 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
// Possibly an oop being stored to Java heap or native memory
if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
// oop to Java heap.
(void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, val->bottom_type(), type);
(void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
} else {
// We can't tell at compile time if we are storing in the Java heap or outside
// of it. So we need to emit code to conditionally do the proper type of
// store.
......@@ -2189,7 +2188,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
kit.declares_done();
// QQQ who knows what probability is here??
kit.if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
(void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, val->bottom_type(), type);
(void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
} kit.else_(); {
(void) store_to_memory(control(), adr, val, type, adr_type, is_volatile);
} kit.end_if();
......@@ -2394,7 +2393,7 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) {
case T_OBJECT:
// reference stores need a store barrier.
// (They don't if CAS fails, but it isn't worth checking.)
pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT);
pre_barrier(control(), base, adr, alias_idx, newval, value_type->is_oopptr(), T_OBJECT);
#ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) {
Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop()));
......@@ -2489,7 +2488,7 @@ bool LibraryCallKit::inline_unsafe_ordered_store(BasicType type) {
bool require_atomic_access = true;
Node* store;
if (type == T_OBJECT) // reference stores need a store barrier.
store = store_oop_to_unknown(control(), base, adr, adr_type, val, value_type, type);
store = store_oop_to_unknown(control(), base, adr, adr_type, val, type);
else {
store = store_to_memory(control(), adr, val, type, adr_type, require_atomic_access);
}
......
......@@ -1565,7 +1565,7 @@ void Parse::do_one_bytecode() {
c = pop(); // Oop to store
b = pop(); // index (already used)
a = pop(); // the array itself
const Type* elemtype = _gvn.type(a)->is_aryptr()->elem();
const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->is_oopptr();
const TypeAryPtr* adr_type = TypeAryPtr::OOPS;
Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT);
break;
......
......@@ -222,7 +222,7 @@ void Parse::do_put_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool
// Store the value.
Node* store;
if (bt == T_OBJECT) {
const TypePtr* field_type;
const TypeOopPtr* field_type;
if (!field->type()->is_loaded()) {
field_type = TypeInstPtr::BOTTOM;
} else {
......@@ -361,7 +361,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in
guarantee(length_con >= 0, "non-constant multianewarray");
ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass();
const TypePtr* adr_type = TypeAryPtr::OOPS;
const Type* elemtype = _gvn.type(array)->is_aryptr()->elem();
const TypeOopPtr* elemtype = _gvn.type(array)->is_aryptr()->elem()->is_oopptr();
const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT);
for (jint i = 0; i < length_con; i++) {
Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册