RFR: 8286490: JvmtiEventControllerPrivate::set_event_callbacks CLEARING_MASK computation is incorrect [v2]
    Alex Menkov 
    amenkov at openjdk.java.net
       
    Tue May 24 22:34:54 UTC 2022
    
    
  
On Tue, 24 May 2022 22:23:59 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
>> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   add extra test coverage for JVMTI extension events: VirtualThreadMount/VirtualThreadUnmount
>
> src/hotspot/share/prims/jvmtiEventController.cpp line 775:
> 
>> 773:   env->set_event_callbacks(callbacks, size_of_callbacks);
>> 774:   // Mask to clear normal event bits.
>> 775:   const jlong CLEARING_MASK = (1L >> (JVMTI_MIN_EVENT_TYPE_VAL - TOTAL_MIN_EVENT_TYPE_VAL)) - 1L;
> 
> I don't follow how this works..
> Should it be "<<" instead of ">>" ?
Maybe it would be clearer to turn off the bits when there are no events:
  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;
      if (!env->has_callback(evt_t)) {
          // clear the bit if there is no callback
          enabled_bits &= ~JvmtiEventEnabled::bit_for(evt_t);
      }
  }
-------------
PR: https://git.openjdk.java.net/jdk/pull/8860
    
    
More information about the serviceability-dev
mailing list