< prev index next >

src/hotspot/share/prims/jvmtiManageCapabilities.cpp

Print this page




 112 #if INCLUDE_JVMCI
 113   if (UseJVMCICompiler) {
 114     jc.can_pop_frame = 0;
 115     jc.can_force_early_return = 0;
 116   }
 117 #endif // INCLUDE_JVMCI
 118 #endif // !ZERO
 119   jc.can_get_source_debug_extension = 1;
 120   jc.can_access_local_variables = 1;
 121   jc.can_maintain_original_method_order = 1;
 122   jc.can_generate_single_step_events = 1;
 123   jc.can_generate_exception_events = 1;
 124   jc.can_generate_frame_pop_events = 1;
 125   jc.can_generate_method_entry_events = 1;
 126   jc.can_generate_method_exit_events = 1;
 127   jc.can_get_owned_monitor_info = 1;
 128   jc.can_get_owned_monitor_stack_depth_info = 1;
 129   jc.can_get_current_contended_monitor = 1;
 130   jc.can_generate_early_vmstart = 1;
 131   jc.can_generate_early_class_hook_events = 1;


 132   return jc;
 133 }
 134 
 135 
 136 jvmtiCapabilities JvmtiManageCapabilities::init_always_solo_capabilities() {
 137   jvmtiCapabilities jc;
 138 
 139   memset(&jc, 0, sizeof(jc));
 140   jc.can_suspend = 1;
 141   jc.can_generate_sampled_object_alloc_events = 1;
 142   return jc;
 143 }
 144 
 145 
 146 jvmtiCapabilities JvmtiManageCapabilities::init_onload_solo_capabilities() {
 147   jvmtiCapabilities jc;
 148 
 149   memset(&jc, 0, sizeof(jc));
 150   jc.can_generate_field_modification_events = 1;
 151   jc.can_generate_field_access_events = 1;


 252   // add to the set of ever acquired capabilities
 253   either(&acquired_capabilities, desired, &acquired_capabilities);
 254 
 255   // onload capabilities that got added are now permanent - so, also remove from onload
 256   both(&onload_capabilities, desired, &temp);
 257   either(&always_capabilities, &temp, &always_capabilities);
 258   exclude(&onload_capabilities, &temp, &onload_capabilities);
 259 
 260   // same for solo capabilities (transferred capabilities in the remaining sets handled as part of standard grab - below)
 261   both(&onload_solo_capabilities, desired, &temp);
 262   either(&always_solo_capabilities, &temp, &always_solo_capabilities);
 263   exclude(&onload_solo_capabilities, &temp, &onload_solo_capabilities);
 264 
 265   // remove solo capabilities that are now taken
 266   exclude(&always_solo_remaining_capabilities, desired, &always_solo_remaining_capabilities);
 267   exclude(&onload_solo_remaining_capabilities, desired, &onload_solo_remaining_capabilities);
 268 
 269   // return the result
 270   either(current, desired, result);
 271 





 272   update();
 273 
 274   return JVMTI_ERROR_NONE;
 275 }
 276 
 277 
 278 void JvmtiManageCapabilities::relinquish_capabilities(const jvmtiCapabilities *current,
 279                                                       const jvmtiCapabilities *unwanted,
 280                                                       jvmtiCapabilities *result) {
 281   jvmtiCapabilities to_trash;
 282   jvmtiCapabilities temp;
 283 
 284   // can't give up what you don't have
 285   both(current, unwanted, &to_trash);
 286 
 287   // restore solo capabilities but only those that belong
 288   either(&always_solo_remaining_capabilities, both(&always_solo_capabilities, &to_trash, &temp),
 289          &always_solo_remaining_capabilities);
 290   either(&onload_solo_remaining_capabilities, both(&onload_solo_capabilities, &to_trash, &temp),
 291          &onload_solo_remaining_capabilities);


 347     avail.can_generate_all_class_hook_events);
 348   JvmtiExport::set_can_walk_any_space(
 349     avail.can_tag_objects);   // disable sharing in onload phase
 350   // This controls whether the compilers keep extra locals live to
 351   // improve the debugging experience so only set them if the selected
 352   // capabilities look like a debugger.
 353   JvmtiExport::set_can_access_local_variables(
 354     avail.can_access_local_variables ||
 355     avail.can_generate_breakpoint_events ||
 356     avail.can_generate_frame_pop_events);
 357   JvmtiExport::set_can_post_on_exceptions(
 358     avail.can_generate_exception_events ||
 359     avail.can_generate_frame_pop_events ||
 360     avail.can_generate_method_exit_events);
 361   JvmtiExport::set_can_post_breakpoint(avail.can_generate_breakpoint_events);
 362   JvmtiExport::set_can_post_field_access(avail.can_generate_field_access_events);
 363   JvmtiExport::set_can_post_field_modification(avail.can_generate_field_modification_events);
 364   JvmtiExport::set_can_post_method_entry(avail.can_generate_method_entry_events);
 365   JvmtiExport::set_can_post_method_exit(avail.can_generate_method_exit_events ||
 366                                         avail.can_generate_frame_pop_events);

 367   JvmtiExport::set_can_pop_frame(avail.can_pop_frame);
 368   JvmtiExport::set_can_force_early_return(avail.can_force_early_return);


 369   JvmtiExport::set_should_clean_up_heap_objects(avail.can_generate_breakpoint_events);
 370 }
 371 
 372 #ifndef PRODUCT
 373 
 374 void JvmtiManageCapabilities:: print(const jvmtiCapabilities* cap) {
 375   log_trace(jvmti)("----- capabilities -----");
 376   if (cap->can_tag_objects)
 377     log_trace(jvmti)("can_tag_objects");
 378   if (cap->can_generate_field_modification_events)
 379     log_trace(jvmti)("can_generate_field_modification_events");
 380   if (cap->can_generate_field_access_events)
 381     log_trace(jvmti)("can_generate_field_access_events");
 382   if (cap->can_get_bytecodes)
 383     log_trace(jvmti)("can_get_bytecodes");
 384   if (cap->can_get_synthetic_attribute)
 385     log_trace(jvmti)("can_get_synthetic_attribute");
 386   if (cap->can_get_owned_monitor_info)
 387     log_trace(jvmti)("can_get_owned_monitor_info");
 388   if (cap->can_get_current_contended_monitor)


 440   if (cap->can_generate_compiled_method_load_events)
 441     log_trace(jvmti)("can_generate_compiled_method_load_events");
 442   if (cap->can_generate_monitor_events)
 443     log_trace(jvmti)("can_generate_monitor_events");
 444   if (cap->can_generate_vm_object_alloc_events)
 445     log_trace(jvmti)("can_generate_vm_object_alloc_events");
 446   if (cap->can_generate_native_method_bind_events)
 447     log_trace(jvmti)("can_generate_native_method_bind_events");
 448   if (cap->can_generate_garbage_collection_events)
 449     log_trace(jvmti)("can_generate_garbage_collection_events");
 450   if (cap->can_generate_object_free_events)
 451     log_trace(jvmti)("can_generate_object_free_events");
 452   if (cap->can_generate_resource_exhaustion_heap_events)
 453     log_trace(jvmti)("can_generate_resource_exhaustion_heap_events");
 454   if (cap->can_generate_resource_exhaustion_threads_events)
 455     log_trace(jvmti)("can_generate_resource_exhaustion_threads_events");
 456   if (cap->can_generate_early_vmstart)
 457     log_trace(jvmti)("can_generate_early_vmstart");
 458   if (cap->can_generate_early_class_hook_events)
 459     log_trace(jvmti)("can_generate_early_class_hook_events");




 460 }
 461 
 462 #endif


 112 #if INCLUDE_JVMCI
 113   if (UseJVMCICompiler) {
 114     jc.can_pop_frame = 0;
 115     jc.can_force_early_return = 0;
 116   }
 117 #endif // INCLUDE_JVMCI
 118 #endif // !ZERO
 119   jc.can_get_source_debug_extension = 1;
 120   jc.can_access_local_variables = 1;
 121   jc.can_maintain_original_method_order = 1;
 122   jc.can_generate_single_step_events = 1;
 123   jc.can_generate_exception_events = 1;
 124   jc.can_generate_frame_pop_events = 1;
 125   jc.can_generate_method_entry_events = 1;
 126   jc.can_generate_method_exit_events = 1;
 127   jc.can_get_owned_monitor_info = 1;
 128   jc.can_get_owned_monitor_stack_depth_info = 1;
 129   jc.can_get_current_contended_monitor = 1;
 130   jc.can_generate_early_vmstart = 1;
 131   jc.can_generate_early_class_hook_events = 1;
 132   jc.can_support_fibers = 1;
 133   jc.can_support_continuations = 1;
 134   return jc;
 135 }
 136 
 137 
 138 jvmtiCapabilities JvmtiManageCapabilities::init_always_solo_capabilities() {
 139   jvmtiCapabilities jc;
 140 
 141   memset(&jc, 0, sizeof(jc));
 142   jc.can_suspend = 1;
 143   jc.can_generate_sampled_object_alloc_events = 1;
 144   return jc;
 145 }
 146 
 147 
 148 jvmtiCapabilities JvmtiManageCapabilities::init_onload_solo_capabilities() {
 149   jvmtiCapabilities jc;
 150 
 151   memset(&jc, 0, sizeof(jc));
 152   jc.can_generate_field_modification_events = 1;
 153   jc.can_generate_field_access_events = 1;


 254   // add to the set of ever acquired capabilities
 255   either(&acquired_capabilities, desired, &acquired_capabilities);
 256 
 257   // onload capabilities that got added are now permanent - so, also remove from onload
 258   both(&onload_capabilities, desired, &temp);
 259   either(&always_capabilities, &temp, &always_capabilities);
 260   exclude(&onload_capabilities, &temp, &onload_capabilities);
 261 
 262   // same for solo capabilities (transferred capabilities in the remaining sets handled as part of standard grab - below)
 263   both(&onload_solo_capabilities, desired, &temp);
 264   either(&always_solo_capabilities, &temp, &always_solo_capabilities);
 265   exclude(&onload_solo_capabilities, &temp, &onload_solo_capabilities);
 266 
 267   // remove solo capabilities that are now taken
 268   exclude(&always_solo_remaining_capabilities, desired, &always_solo_remaining_capabilities);
 269   exclude(&onload_solo_remaining_capabilities, desired, &onload_solo_remaining_capabilities);
 270 
 271   // return the result
 272   either(current, desired, result);
 273 
 274   // special case for Fiber events
 275   if (result->can_support_fibers == 1) {
 276     java_lang_Fiber::set_notify_jvmti_events(true);
 277   }
 278 
 279   update();
 280 
 281   return JVMTI_ERROR_NONE;
 282 }
 283 
 284 
 285 void JvmtiManageCapabilities::relinquish_capabilities(const jvmtiCapabilities *current,
 286                                                       const jvmtiCapabilities *unwanted,
 287                                                       jvmtiCapabilities *result) {
 288   jvmtiCapabilities to_trash;
 289   jvmtiCapabilities temp;
 290 
 291   // can't give up what you don't have
 292   both(current, unwanted, &to_trash);
 293 
 294   // restore solo capabilities but only those that belong
 295   either(&always_solo_remaining_capabilities, both(&always_solo_capabilities, &to_trash, &temp),
 296          &always_solo_remaining_capabilities);
 297   either(&onload_solo_remaining_capabilities, both(&onload_solo_capabilities, &to_trash, &temp),
 298          &onload_solo_remaining_capabilities);


 354     avail.can_generate_all_class_hook_events);
 355   JvmtiExport::set_can_walk_any_space(
 356     avail.can_tag_objects);   // disable sharing in onload phase
 357   // This controls whether the compilers keep extra locals live to
 358   // improve the debugging experience so only set them if the selected
 359   // capabilities look like a debugger.
 360   JvmtiExport::set_can_access_local_variables(
 361     avail.can_access_local_variables ||
 362     avail.can_generate_breakpoint_events ||
 363     avail.can_generate_frame_pop_events);
 364   JvmtiExport::set_can_post_on_exceptions(
 365     avail.can_generate_exception_events ||
 366     avail.can_generate_frame_pop_events ||
 367     avail.can_generate_method_exit_events);
 368   JvmtiExport::set_can_post_breakpoint(avail.can_generate_breakpoint_events);
 369   JvmtiExport::set_can_post_field_access(avail.can_generate_field_access_events);
 370   JvmtiExport::set_can_post_field_modification(avail.can_generate_field_modification_events);
 371   JvmtiExport::set_can_post_method_entry(avail.can_generate_method_entry_events);
 372   JvmtiExport::set_can_post_method_exit(avail.can_generate_method_exit_events ||
 373                                         avail.can_generate_frame_pop_events);
 374   JvmtiExport::set_can_post_frame_pop(avail.can_generate_frame_pop_events);
 375   JvmtiExport::set_can_pop_frame(avail.can_pop_frame);
 376   JvmtiExport::set_can_force_early_return(avail.can_force_early_return);
 377   JvmtiExport::set_can_support_fibers(avail.can_support_fibers);
 378   JvmtiExport::set_can_support_continuations(avail.can_support_continuations);
 379   JvmtiExport::set_should_clean_up_heap_objects(avail.can_generate_breakpoint_events);
 380 }
 381 
 382 #ifndef PRODUCT
 383 
 384 void JvmtiManageCapabilities:: print(const jvmtiCapabilities* cap) {
 385   log_trace(jvmti)("----- capabilities -----");
 386   if (cap->can_tag_objects)
 387     log_trace(jvmti)("can_tag_objects");
 388   if (cap->can_generate_field_modification_events)
 389     log_trace(jvmti)("can_generate_field_modification_events");
 390   if (cap->can_generate_field_access_events)
 391     log_trace(jvmti)("can_generate_field_access_events");
 392   if (cap->can_get_bytecodes)
 393     log_trace(jvmti)("can_get_bytecodes");
 394   if (cap->can_get_synthetic_attribute)
 395     log_trace(jvmti)("can_get_synthetic_attribute");
 396   if (cap->can_get_owned_monitor_info)
 397     log_trace(jvmti)("can_get_owned_monitor_info");
 398   if (cap->can_get_current_contended_monitor)


 450   if (cap->can_generate_compiled_method_load_events)
 451     log_trace(jvmti)("can_generate_compiled_method_load_events");
 452   if (cap->can_generate_monitor_events)
 453     log_trace(jvmti)("can_generate_monitor_events");
 454   if (cap->can_generate_vm_object_alloc_events)
 455     log_trace(jvmti)("can_generate_vm_object_alloc_events");
 456   if (cap->can_generate_native_method_bind_events)
 457     log_trace(jvmti)("can_generate_native_method_bind_events");
 458   if (cap->can_generate_garbage_collection_events)
 459     log_trace(jvmti)("can_generate_garbage_collection_events");
 460   if (cap->can_generate_object_free_events)
 461     log_trace(jvmti)("can_generate_object_free_events");
 462   if (cap->can_generate_resource_exhaustion_heap_events)
 463     log_trace(jvmti)("can_generate_resource_exhaustion_heap_events");
 464   if (cap->can_generate_resource_exhaustion_threads_events)
 465     log_trace(jvmti)("can_generate_resource_exhaustion_threads_events");
 466   if (cap->can_generate_early_vmstart)
 467     log_trace(jvmti)("can_generate_early_vmstart");
 468   if (cap->can_generate_early_class_hook_events)
 469     log_trace(jvmti)("can_generate_early_class_hook_events");
 470   if (cap->can_support_fibers)
 471     log_trace(jvmti)("can_support_fibers");
 472   if (cap->can_support_continuations)
 473     log_trace(jvmti)("can_support_continuations");
 474 }
 475 
 476 #endif
< prev index next >