Add equals/hashcode to MemorySegment

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • None
    • Affects Version/s: repo-panama
    • Component/s: tools

      MemorySegment should have a way to compare its instances; this could be useful when e.g. using a memory segment as a hashmap key. Of course there are two possible ways to compare a segment:

      * shallow comparison: we just compare segment properties such as size and backing region, to make sure they point to the same region.

      * structural comparison: we perform a byte-wise comparison of the segment contents.

      The latter operation, while useful, is also very expensive (as its complexity depends on the segment size). MemorySegment already provides a way to compare contents (see MemorySegment::mismatch), so what makes most sense here is to compare segments by making sure they point to the same memory region.

            Assignee:
            Maurizio Cimadamore
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: