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

JvmtiEventControllerPrivate::set_event_callbacks CLEARING_MASK computation is incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 19
    • Fix Version/s: 19
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b24

      Description

      Loom added the following code in JvmtiEventControllerPrivate::set_event_callbacks:

        // Mask to clear normal event bits.
        const jlong CLEARING_MASK = (1L >> (TOTAL_MIN_EVENT_TYPE_VAL - TOTAL_MIN_EVENT_TYPE_VAL)) - 1L;
        // Avoid cleaning extension event bits.
        jlong enabled_bits = CLEARING_MASK & env->env_event_enable()->_event_callback_enabled.get_bits();

      But the CLEARING_MASK is computed weirdly/incorrectly:
       a) It subtracts TOTAL_MIN_EVENT_TYPE_VAL from itself, always yielding 0;
       b) It shifts 1L to the right, which means the subexpression would produce either 0 or 1; or, after -1L, either 0 or -1 (full mask?).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sspitsyn Serguei Spitsyn
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: