RFR: 8269119: C2: Avoid redundant memory barriers in Unsafe.copyMemory0 intrinsic [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Thu Sep 2 14:24:13 UTC 2021


On Thu, 2 Sep 2021 13:22:12 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove memory barriers
>
> src/hotspot/share/opto/library_call.cpp line 4074:
> 
>> 4072: 
>> 4073: //----------------------has_wide_mem-------------------------
>> 4074: bool LibraryCallKit::has_wide_mem(Node* addr, Node* base) {
> 
> Why do you need both arguments? Isn't addr sufficient?

It mimics similar checks from `LibraryCallKit::inline_unsafe_access()`:


  if (_gvn.type(base)->isa_ptr() == TypePtr::NULL_PTR) {
    if (type != T_OBJECT) {
      decorators |= IN_NATIVE; // off-heap primitive access
    } else {
      set_map(old_map);
      set_sp(old_sp);
      return false; // off-heap oop accesses are not supported
    }
  } else {
    heap_base_oop = base; // on-heap or mixed access
  }

  // Can base be NULL? Otherwise, always on-heap access.
  bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(base));

  if (!can_access_non_heap) {
    decorators |= IN_HEAP;
  }

-------------

PR: https://git.openjdk.java.net/jdk/pull/5259


More information about the hotspot-compiler-dev mailing list