Harmony
  1. Harmony
  2. HARMONY-6137

[drlvm][concurrent] AtomicLong compare and swap returning wrong indicator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M9
    • Component/s: DRLVM
    • Labels:
      None
    • Environment:
      Linux, r761319

      Description

      Consider the following code that exercises AtomLong compare and swap operations:

      AtomicLong atomLong = new AtomicLong(1);
      System.out.println(atomLong.get());
      System.out.println("CAS 1,-4 = " + atomLong.compareAndSet(1, -4));
      System.out.println(atomLong.get());
      System.out.println("CAS -5,1 = " + atomLong.compareAndSet(-5, 1));
      System.out.println(atomLong.get());

      I expect it to print out:
      1
      CAS 1,-4 = true
      -4
      CAS -5,1 = false
      -4

      Since the comparison of --4 and -5 fails.
      However when running that code on harmony r761319 I see

      1
      CAS 1,-4 = true
      -4
      CAS -5,1 = true
      -4

      i.e. the swap is not done, but the method returned true as though it had done the swap.

        Activity

        Tim Ellison created issue -
        Egor Pasko made changes -
        Field Original Value New Value
        Attachment 0001-add-memory-to-clobber-list-for-port_atomic_cas64.patch [ 12404512 ]
        Egor Pasko made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0M9 [ 12313526 ]
        Resolution Fixed [ 1 ]
        Tim Ellison made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Tim Ellison
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development