2407 2408 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || 2409 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); 2410 bool mismatched = false; 2411 BasicType bt = alias_type->basic_type(); 2412 if (bt != T_ILLEGAL) { 2413 if (bt == T_BYTE && adr_type->isa_aryptr()) { 2414 // Alias type doesn't differentiate between byte[] and boolean[]). 2415 // Use address type to get the element type. 2416 bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); 2417 } 2418 if (bt == T_ARRAY || bt == T_NARROWOOP) { 2419 // accessing an array field with getObject is not a mismatch 2420 bt = T_OBJECT; 2421 } 2422 if ((bt == T_OBJECT) != (type == T_OBJECT)) { 2423 // Don't intrinsify mismatched object accesses 2424 return false; 2425 } 2426 mismatched = (bt != type); 2427 } 2428 2429 // First guess at the value type. 2430 const Type *value_type = Type::get_const_basic_type(type); 2431 2432 // We will need memory barriers unless we can determine a unique 2433 // alias category for this reference. (Note: If for some reason 2434 // the barriers get omitted and the unsafe reference begins to "pollute" 2435 // the alias analysis of the rest of the graph, either Compile::can_alias 2436 // or Compile::must_alias will throw a diagnostic assert.) 2437 bool need_mem_bar; 2438 switch (kind) { 2439 case Relaxed: 2440 need_mem_bar = (alias_type->adr_type() == TypeOopPtr::BOTTOM); 2441 break; 2442 case Opaque: 2443 // Opaque uses CPUOrder membars for protection against code movement. 2444 case Acquire: 2445 case Release: 2446 case Volatile: | 2407 2408 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || 2409 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); 2410 bool mismatched = false; 2411 BasicType bt = alias_type->basic_type(); 2412 if (bt != T_ILLEGAL) { 2413 if (bt == T_BYTE && adr_type->isa_aryptr()) { 2414 // Alias type doesn't differentiate between byte[] and boolean[]). 2415 // Use address type to get the element type. 2416 bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); 2417 } 2418 if (bt == T_ARRAY || bt == T_NARROWOOP) { 2419 // accessing an array field with getObject is not a mismatch 2420 bt = T_OBJECT; 2421 } 2422 if ((bt == T_OBJECT) != (type == T_OBJECT)) { 2423 // Don't intrinsify mismatched object accesses 2424 return false; 2425 } 2426 mismatched = (bt != type); 2427 } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) { 2428 mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched 2429 } 2430 2431 // First guess at the value type. 2432 const Type *value_type = Type::get_const_basic_type(type); 2433 2434 // We will need memory barriers unless we can determine a unique 2435 // alias category for this reference. (Note: If for some reason 2436 // the barriers get omitted and the unsafe reference begins to "pollute" 2437 // the alias analysis of the rest of the graph, either Compile::can_alias 2438 // or Compile::must_alias will throw a diagnostic assert.) 2439 bool need_mem_bar; 2440 switch (kind) { 2441 case Relaxed: 2442 need_mem_bar = (alias_type->adr_type() == TypeOopPtr::BOTTOM); 2443 break; 2444 case Opaque: 2445 // Opaque uses CPUOrder membars for protection against code movement. 2446 case Acquire: 2447 case Release: 2448 case Volatile: |