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

Add atomic bitset functions

    XMLWordPrintable

Details

    • b21

    Backports

      Description

        We need an Atomic version of setting bits, e.g. and/or/xor, like the one in accessFlags for general purpose use.

        From [~jrose]

        Suggestions for API shape:
        Mimic whatever the intel intrinsics do for and/or/xor/add. Prefer their names.
        But, stay within the boundaries of what the C++ atomic API does (omit op-and-fetch, keep only fetch-and-op). Use their names if it makes sense.
        Key requirement: Have the return value contain enough information to infer the previous state of the variable, for those who care.
        Key requirement: Robustly support “set one bit” and “clear one bit”, probably by logior and logand of multi-bit masks.
        Higher-level bit setter could be update_bits(T bits, bool new_state) -> T old_bits. The higher-level setter could use the optimization of not issuing a CAS if the bit (or bits) is (are) in the desired new state already.

        Attachments

          Issue Links

            Activity

              People

                kbarrett Kim Barrett
                coleenp Coleen Phillimore
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: