- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    19
- 
        b24
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8332162 | 17.0.12 | Roman Marchenko | P4 | Resolved | Fixed | b03 | 
                    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?).
// 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?).
- backported by
- 
                    JDK-8332162 JvmtiEventControllerPrivate::set_event_callbacks CLEARING_MASK computation is incorrect -           
- Resolved
 
-         
 
         
         
        