mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6818666: G1: Type lost in g1 pre-barrier
Reviewed-by: kvn
This commit is contained in:
parent
a9ad90fa87
commit
3bdd70fe18
5 changed files with 36 additions and 21 deletions
|
@ -1378,7 +1378,7 @@ void GraphKit::pre_barrier(Node* ctl,
|
||||||
Node* adr,
|
Node* adr,
|
||||||
uint adr_idx,
|
uint adr_idx,
|
||||||
Node *val,
|
Node *val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt) {
|
BasicType bt) {
|
||||||
BarrierSet* bs = Universe::heap()->barrier_set();
|
BarrierSet* bs = Universe::heap()->barrier_set();
|
||||||
set_control(ctl);
|
set_control(ctl);
|
||||||
|
@ -1436,7 +1436,7 @@ Node* GraphKit::store_oop_to_object(Node* ctl,
|
||||||
Node* adr,
|
Node* adr,
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node *val,
|
Node *val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt) {
|
BasicType bt) {
|
||||||
uint adr_idx = C->get_alias_index(adr_type);
|
uint adr_idx = C->get_alias_index(adr_type);
|
||||||
Node* store;
|
Node* store;
|
||||||
|
@ -1451,7 +1451,7 @@ Node* GraphKit::store_oop_to_array(Node* ctl,
|
||||||
Node* adr,
|
Node* adr,
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node *val,
|
Node *val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt) {
|
BasicType bt) {
|
||||||
uint adr_idx = C->get_alias_index(adr_type);
|
uint adr_idx = C->get_alias_index(adr_type);
|
||||||
Node* store;
|
Node* store;
|
||||||
|
@ -1466,12 +1466,29 @@ Node* GraphKit::store_oop_to_unknown(Node* ctl,
|
||||||
Node* adr,
|
Node* adr,
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node *val,
|
Node *val,
|
||||||
const Type* val_type,
|
|
||||||
BasicType bt) {
|
BasicType bt) {
|
||||||
uint adr_idx = C->get_alias_index(adr_type);
|
Compile::AliasType* at = C->alias_type(adr_type);
|
||||||
Node* store;
|
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);
|
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);
|
post_barrier(control(), store, obj, adr, adr_idx, val, bt, true);
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
@ -3202,7 +3219,7 @@ void GraphKit::g1_write_barrier_pre(Node* obj,
|
||||||
Node* adr,
|
Node* adr,
|
||||||
uint alias_idx,
|
uint alias_idx,
|
||||||
Node* val,
|
Node* val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt) {
|
BasicType bt) {
|
||||||
IdealKit ideal(gvn(), control(), merged_memory(), true);
|
IdealKit ideal(gvn(), control(), merged_memory(), true);
|
||||||
#define __ ideal.
|
#define __ ideal.
|
||||||
|
|
|
@ -454,7 +454,7 @@ class GraphKit : public Phase {
|
||||||
Node* adr, // actual adress to store val at
|
Node* adr, // actual adress to store val at
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node* val,
|
Node* val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt);
|
BasicType bt);
|
||||||
|
|
||||||
Node* store_oop_to_array(Node* ctl,
|
Node* store_oop_to_array(Node* ctl,
|
||||||
|
@ -462,7 +462,7 @@ class GraphKit : public Phase {
|
||||||
Node* adr, // actual adress to store val at
|
Node* adr, // actual adress to store val at
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node* val,
|
Node* val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt);
|
BasicType bt);
|
||||||
|
|
||||||
// Could be an array or object we don't know at compile time (unsafe ref.)
|
// 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
|
Node* adr, // actual adress to store val at
|
||||||
const TypePtr* adr_type,
|
const TypePtr* adr_type,
|
||||||
Node* val,
|
Node* val,
|
||||||
const Type* val_type,
|
|
||||||
BasicType bt);
|
BasicType bt);
|
||||||
|
|
||||||
// For the few case where the barriers need special help
|
// For the few case where the barriers need special help
|
||||||
void pre_barrier(Node* ctl, Node* obj, Node* adr, uint adr_idx,
|
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,
|
void post_barrier(Node* ctl, Node* store, Node* obj, Node* adr, uint adr_idx,
|
||||||
Node* val, BasicType bt, bool use_precise);
|
Node* val, BasicType bt, bool use_precise);
|
||||||
|
@ -599,7 +598,7 @@ class GraphKit : public Phase {
|
||||||
Node* adr,
|
Node* adr,
|
||||||
uint alias_idx,
|
uint alias_idx,
|
||||||
Node* val,
|
Node* val,
|
||||||
const Type* val_type,
|
const TypeOopPtr* val_type,
|
||||||
BasicType bt);
|
BasicType bt);
|
||||||
|
|
||||||
void g1_write_barrier_post(Node* store,
|
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
|
// Possibly an oop being stored to Java heap or native memory
|
||||||
if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
|
if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
|
||||||
// oop to Java heap.
|
// 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 {
|
} else {
|
||||||
|
|
||||||
// We can't tell at compile time if we are storing in the Java heap or outside
|
// 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
|
// of it. So we need to emit code to conditionally do the proper type of
|
||||||
// store.
|
// store.
|
||||||
|
@ -2189,7 +2188,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
|
||||||
kit.declares_done();
|
kit.declares_done();
|
||||||
// QQQ who knows what probability is here??
|
// QQQ who knows what probability is here??
|
||||||
kit.if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
|
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_(); {
|
} kit.else_(); {
|
||||||
(void) store_to_memory(control(), adr, val, type, adr_type, is_volatile);
|
(void) store_to_memory(control(), adr, val, type, adr_type, is_volatile);
|
||||||
} kit.end_if();
|
} kit.end_if();
|
||||||
|
@ -2394,7 +2393,7 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) {
|
||||||
case T_OBJECT:
|
case T_OBJECT:
|
||||||
// reference stores need a store barrier.
|
// reference stores need a store barrier.
|
||||||
// (They don't if CAS fails, but it isn't worth checking.)
|
// (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
|
#ifdef _LP64
|
||||||
if (adr->bottom_type()->is_ptr_to_narrowoop()) {
|
if (adr->bottom_type()->is_ptr_to_narrowoop()) {
|
||||||
Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_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;
|
bool require_atomic_access = true;
|
||||||
Node* store;
|
Node* store;
|
||||||
if (type == T_OBJECT) // reference stores need a store barrier.
|
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 {
|
else {
|
||||||
store = store_to_memory(control(), adr, val, type, adr_type, require_atomic_access);
|
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
|
c = pop(); // Oop to store
|
||||||
b = pop(); // index (already used)
|
b = pop(); // index (already used)
|
||||||
a = pop(); // the array itself
|
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;
|
const TypeAryPtr* adr_type = TypeAryPtr::OOPS;
|
||||||
Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT);
|
Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -222,7 +222,7 @@ void Parse::do_put_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool
|
||||||
// Store the value.
|
// Store the value.
|
||||||
Node* store;
|
Node* store;
|
||||||
if (bt == T_OBJECT) {
|
if (bt == T_OBJECT) {
|
||||||
const TypePtr* field_type;
|
const TypeOopPtr* field_type;
|
||||||
if (!field->type()->is_loaded()) {
|
if (!field->type()->is_loaded()) {
|
||||||
field_type = TypeInstPtr::BOTTOM;
|
field_type = TypeInstPtr::BOTTOM;
|
||||||
} else {
|
} else {
|
||||||
|
@ -361,7 +361,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in
|
||||||
guarantee(length_con >= 0, "non-constant multianewarray");
|
guarantee(length_con >= 0, "non-constant multianewarray");
|
||||||
ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass();
|
ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass();
|
||||||
const TypePtr* adr_type = TypeAryPtr::OOPS;
|
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);
|
const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT);
|
||||||
for (jint i = 0; i < length_con; i++) {
|
for (jint i = 0; i < length_con; i++) {
|
||||||
Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
|
Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue