Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8142368

Copy::fill_to_memory_atomic is using Sparc BIS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 12
    • 9
    • hotspot
    • None
    • generic
    • generic

      The Copy::fill_to_memory_atomic function (used to implement Unsafe.setMemory) uses appropriately sized stores in for-loops to implement the described semantics, under the assumption that the appropriately aligned and sized stores will be atomic.

      However, we have seen recent versions of Solaris Studio transforming similar for-loops into calls to memset, which may be implemented using Sparc block initializing store (BIS) instructions (JDK-8131330). Using BIS would violate the atomicity guarantees for these functions.

      I've not checked the generated code to see if that transformation is actually happening now, but even if it's not, it is still a possibility in the future; the loop to (possibly BIS-using) memset transformation is a pretty obvious possible optimization that is safe in most situations.

      And in particular, the unaligned case handled by calling Copy::fill_to_bytes is both trivially transformable to memset (except for the possibility of "out of thin air" intermediate zeros being introduced by BIS), and is currently implemented by calling memset on all supported platforms (including Sparc).

            Unassigned Unassigned
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: