src/share/vm/runtime/vmThread.cpp

Print this page
rev 4201 : 8007147: Trace event ExecuteVMOperation may get dangling pointer
Reviewed-by:


 369 
 370   {
 371     PerfTraceTime vm_op_timer(perf_accumulated_vm_operation_time());
 372 #ifndef USDT2
 373     HS_DTRACE_PROBE3(hotspot, vmops__begin, op->name(), strlen(op->name()),
 374                      op->evaluation_mode());
 375 #else /* USDT2 */
 376     HOTSPOT_VMOPS_BEGIN(
 377                      (char *) op->name(), strlen(op->name()),
 378                      op->evaluation_mode());
 379 #endif /* USDT2 */
 380 
 381     EventExecuteVMOperation event;
 382 
 383     op->evaluate();
 384 
 385     if (event.should_commit()) {
 386       event.set_operation(op->type());
 387       event.set_safepoint(op->evaluate_at_safepoint());
 388       event.set_blocking(!op->evaluate_concurrently());
 389       event.set_caller(op->calling_thread()->osthread()->thread_id());


 390       event.commit();
 391     }
 392 
 393 #ifndef USDT2
 394     HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
 395                      op->evaluation_mode());
 396 #else /* USDT2 */
 397     HOTSPOT_VMOPS_END(
 398                      (char *) op->name(), strlen(op->name()),
 399                      op->evaluation_mode());
 400 #endif /* USDT2 */
 401   }
 402 
 403   // Last access of info in _cur_vm_operation!
 404   bool c_heap_allocated = op->is_cheap_allocated();
 405 
 406   // Mark as completed
 407   if (!op->evaluate_concurrently()) {
 408     op->calling_thread()->increment_vm_operation_completed_count();
 409   }




 369 
 370   {
 371     PerfTraceTime vm_op_timer(perf_accumulated_vm_operation_time());
 372 #ifndef USDT2
 373     HS_DTRACE_PROBE3(hotspot, vmops__begin, op->name(), strlen(op->name()),
 374                      op->evaluation_mode());
 375 #else /* USDT2 */
 376     HOTSPOT_VMOPS_BEGIN(
 377                      (char *) op->name(), strlen(op->name()),
 378                      op->evaluation_mode());
 379 #endif /* USDT2 */
 380 
 381     EventExecuteVMOperation event;
 382 
 383     op->evaluate();
 384 
 385     if (event.should_commit()) {
 386       event.set_operation(op->type());
 387       event.set_safepoint(op->evaluate_at_safepoint());
 388       event.set_blocking(!op->evaluate_concurrently());
 389       // Only write caller thread information for non-concurrent vm operations.
 390       // For concurrent vm operations, the caller thread could have exited already.
 391       event.set_caller(op->evaluate_concurrently() ? 0 : op->calling_thread()->osthread()->thread_id());
 392       event.commit();
 393     }
 394 
 395 #ifndef USDT2
 396     HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
 397                      op->evaluation_mode());
 398 #else /* USDT2 */
 399     HOTSPOT_VMOPS_END(
 400                      (char *) op->name(), strlen(op->name()),
 401                      op->evaluation_mode());
 402 #endif /* USDT2 */
 403   }
 404 
 405   // Last access of info in _cur_vm_operation!
 406   bool c_heap_allocated = op->is_cheap_allocated();
 407 
 408   // Mark as completed
 409   if (!op->evaluate_concurrently()) {
 410     op->calling_thread()->increment_vm_operation_completed_count();
 411   }