src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/library_call.cpp Thu Apr 14 19:51:56 2016
--- new/src/share/vm/opto/library_call.cpp Thu Apr 14 19:51:56 2016
*** 2414,2431 ****
--- 2414,2448 ----
val = is_store ? argument(3) : NULL;
}
const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
// First guess at the value type.
const Type *value_type = Type::get_const_basic_type(type);
// Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM,
// there was not enough information to nail it down.
Compile::AliasType* alias_type = C->alias_type(adr_type);
assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
+ assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM ||
+ alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown");
+ bool mismatched = false;
+ BasicType bt = alias_type->basic_type();
+ if (bt != T_ILLEGAL) {
+ if (bt == T_ARRAY) {
+ // accessing an array field with getObject is not a mismatch
+ bt = T_OBJECT;
+ }
+ if ((bt == T_OBJECT) != (type == T_OBJECT)) {
+ // Don't intrinsify mismatched object accesses
+ return false;
+ }
+ mismatched = (bt != type);
+ assert(type != T_OBJECT || !unaligned, "unaligned access not supported with object type");
+ }
+
+ // First guess at the value type.
+ const Type *value_type = Type::get_const_basic_type(type);
+
// We will need memory barriers unless we can determine a unique
// alias category for this reference. (Note: If for some reason
// the barriers get omitted and the unsafe reference begins to "pollute"
// the alias analysis of the rest of the graph, either Compile::can_alias
// or Compile::must_alias will throw a diagnostic assert.)
*** 2522,2554 ****
--- 2539,2548 ----
// exception paths do not take memory state from the memory barrier,
// so there's no problems making a strong assert about mixing users
// of safe & unsafe memory.
if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder);
assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM ||
alias_type->field() != NULL || alias_type->element() != NULL, "field, array element or unknown");
bool mismatched = false;
if (alias_type->element() != NULL || alias_type->field() != NULL) {
BasicType bt;
if (alias_type->element() != NULL) {
// Use address type to get the element type. Alias type doesn't provide
// enough information (e.g., doesn't differentiate between byte[] and boolean[]).
const Type* element = adr_type->is_aryptr()->elem();
bt = element->isa_narrowoop() ? T_OBJECT : element->array_element_basic_type();
} else {
bt = alias_type->field()->layout_type();
}
if (bt == T_ARRAY) {
// accessing an array field with getObject is not a mismatch
bt = T_OBJECT;
}
if (bt != type) {
mismatched = true;
}
}
assert(type != T_OBJECT || !unaligned, "unaligned access not supported with object type");
if (!is_store) {
Node* p = NULL;
// Try to constant fold a load from a constant field
ciField* field = alias_type->field();
if (heap_base_oop != top() && field != NULL && field->is_constant() && !mismatched) {
*** 2812,2826 ****
--- 2806,2829 ----
// 32-bit machines ignore the high half of long offsets
offset = ConvL2X(offset);
Node* adr = make_unsafe_address(base, offset);
const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
+ Compile::AliasType* alias_type = C->alias_type(adr_type);
+ assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM ||
+ alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown");
+ BasicType bt = alias_type->basic_type();
+ if (bt != T_ILLEGAL &&
+ ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) {
+ // Don't intrinsify mismatched object accesses.
+ return false;
+ }
+
// For CAS, unlike inline_unsafe_access, there seems no point in
// trying to refine types. Just use the coarse types here.
const Type *value_type = Type::get_const_basic_type(type);
Compile::AliasType* alias_type = C->alias_type(adr_type);
assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
+ const Type *value_type = Type::get_const_basic_type(type);
switch (kind) {
case LS_get_set:
case LS_cmp_exchange: {
if (type == T_OBJECT) {
src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File