RFR: 8286490: JvmtiEventControllerPrivate::set_event_callbacks CLEARING_MASK computation is incorrect [v2]

Alex Menkov amenkov at openjdk.java.net
Wed May 25 00:44:58 UTC 2022


On Wed, 25 May 2022 00:21:28 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> Clearing event bits to make it more readable looks like a good idea.
>> What about the following? :
>> 
>>   jlong enabled_bits = env->env_event_enable()->_event_callback_enabled.get_bits();
>>   for (int ei = JVMTI_MIN_EVENT_TYPE_VAL; ei <= JVMTI_MAX_EVENT_TYPE_VAL; ++ei) {
>>     jvmtiEvent evt_t = (jvmtiEvent)ei;
>>     jlong bit_for = JvmtiEventEnabled::bit_for(evt_t);
>>     if (env->has_callback(evt_t)) {
>>       enabled_bits |= bit_for;
>>     } else {
>>       enabled_bits &= ~bit_for;
>>     }
>>   }
>
> Alex, I've removed the CLEARING_MASK and implemented your suggestion which makes the code more clear.

Thank you. It looks much clearer to me now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8860


More information about the serviceability-dev mailing list