< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page
rev 54212 : 8220714: C2 Compilation failure when accessing off-heap memory using Unsafe


2390   // The base is either a Java object or a value produced by Unsafe.staticFieldBase
2391   Node* base = argument(1);  // type: oop
2392   // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
2393   offset = argument(2);  // type: long
2394   // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
2395   // to be plain byte offsets, which are also the same as those accepted
2396   // by oopDesc::field_addr.
2397   assert(Unsafe_field_offset_to_byte_offset(11) == 11,
2398          "fieldOffset must be byte-scaled");
2399   // 32-bit machines ignore the high half!
2400   offset = ConvL2X(offset);
2401   adr = make_unsafe_address(base, offset, is_store ? ACCESS_WRITE : ACCESS_READ, type, kind == Relaxed);
2402 
2403   if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) {
2404     heap_base_oop = base;
2405   } else if (type == T_OBJECT) {
2406     return false; // off-heap oop accesses are not supported
2407   }
2408 
2409   // Can base be NULL? Otherwise, always on-heap access.
2410   bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop));
2411 
2412   if (!can_access_non_heap) {
2413     decorators |= IN_HEAP;
2414   }
2415 
2416   val = is_store ? argument(4) : NULL;
2417 
2418   const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
2419 
2420   // Try to categorize the address.
2421   Compile::AliasType* alias_type = C->alias_type(adr_type);
2422   assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
2423 
2424   if (alias_type->adr_type() == TypeInstPtr::KLASS ||
2425       alias_type->adr_type() == TypeAryPtr::RANGE) {
2426     return false; // not supported
2427   }
2428 
2429   bool mismatched = false;
2430   BasicType bt = alias_type->basic_type();




2390   // The base is either a Java object or a value produced by Unsafe.staticFieldBase
2391   Node* base = argument(1);  // type: oop
2392   // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
2393   offset = argument(2);  // type: long
2394   // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
2395   // to be plain byte offsets, which are also the same as those accepted
2396   // by oopDesc::field_addr.
2397   assert(Unsafe_field_offset_to_byte_offset(11) == 11,
2398          "fieldOffset must be byte-scaled");
2399   // 32-bit machines ignore the high half!
2400   offset = ConvL2X(offset);
2401   adr = make_unsafe_address(base, offset, is_store ? ACCESS_WRITE : ACCESS_READ, type, kind == Relaxed);
2402 
2403   if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) {
2404     heap_base_oop = base;
2405   } else if (type == T_OBJECT) {
2406     return false; // off-heap oop accesses are not supported
2407   }
2408 
2409   // Can base be NULL? Otherwise, always on-heap access.
2410   bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(base));
2411 
2412   if (!can_access_non_heap) {
2413     decorators |= IN_HEAP;
2414   }
2415 
2416   val = is_store ? argument(4) : NULL;
2417 
2418   const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
2419 
2420   // Try to categorize the address.
2421   Compile::AliasType* alias_type = C->alias_type(adr_type);
2422   assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
2423 
2424   if (alias_type->adr_type() == TypeInstPtr::KLASS ||
2425       alias_type->adr_type() == TypeAryPtr::RANGE) {
2426     return false; // not supported
2427   }
2428 
2429   bool mismatched = false;
2430   BasicType bt = alias_type->basic_type();


< prev index next >