613 if (!concurrent) { 614 // Wait for completion of request (non-concurrent) 615 // Note: only a JavaThread triggers the safepoint check when locking 616 MutexLocker mu(VMOperationRequest_lock); 617 while(t->vm_operation_completed_count() < ticket) { 618 VMOperationRequest_lock->wait(!t->is_Java_thread()); 619 } 620 } 621 622 if (execute_epilog) { 623 op->doit_epilogue(); 624 } 625 } else { 626 // invoked by VM thread; usually nested VM operation 627 assert(t->is_VM_thread(), "must be a VM thread"); 628 VM_Operation* prev_vm_operation = vm_operation(); 629 if (prev_vm_operation != NULL) { 630 // Check the VM operation allows nested VM operation. This normally not the case, e.g., the compiler 631 // does not allow nested scavenges or compiles. 632 if (!prev_vm_operation->allow_nested_vm_operations()) { 633 fatal(err_msg("Nested VM operation %s requested by operation %s", 634 op->name(), vm_operation()->name())); 635 } 636 op->set_calling_thread(prev_vm_operation->calling_thread(), prev_vm_operation->priority()); 637 } 638 639 EventMark em("Executing %s VM operation: %s", prev_vm_operation ? "nested" : "", op->name()); 640 641 // Release all internal handles after operation is evaluated 642 HandleMark hm(t); 643 _cur_vm_operation = op; 644 645 if (op->evaluate_at_safepoint() && !SafepointSynchronize::is_at_safepoint()) { 646 SafepointSynchronize::begin(); 647 op->evaluate(); 648 SafepointSynchronize::end(); 649 } else { 650 op->evaluate(); 651 } 652 653 // Free memory if needed 654 if (op->is_cheap_allocated()) delete op; | 613 if (!concurrent) { 614 // Wait for completion of request (non-concurrent) 615 // Note: only a JavaThread triggers the safepoint check when locking 616 MutexLocker mu(VMOperationRequest_lock); 617 while(t->vm_operation_completed_count() < ticket) { 618 VMOperationRequest_lock->wait(!t->is_Java_thread()); 619 } 620 } 621 622 if (execute_epilog) { 623 op->doit_epilogue(); 624 } 625 } else { 626 // invoked by VM thread; usually nested VM operation 627 assert(t->is_VM_thread(), "must be a VM thread"); 628 VM_Operation* prev_vm_operation = vm_operation(); 629 if (prev_vm_operation != NULL) { 630 // Check the VM operation allows nested VM operation. This normally not the case, e.g., the compiler 631 // does not allow nested scavenges or compiles. 632 if (!prev_vm_operation->allow_nested_vm_operations()) { 633 fatal("Nested VM operation %s requested by operation %s", 634 op->name(), vm_operation()->name()); 635 } 636 op->set_calling_thread(prev_vm_operation->calling_thread(), prev_vm_operation->priority()); 637 } 638 639 EventMark em("Executing %s VM operation: %s", prev_vm_operation ? "nested" : "", op->name()); 640 641 // Release all internal handles after operation is evaluated 642 HandleMark hm(t); 643 _cur_vm_operation = op; 644 645 if (op->evaluate_at_safepoint() && !SafepointSynchronize::is_at_safepoint()) { 646 SafepointSynchronize::begin(); 647 op->evaluate(); 648 SafepointSynchronize::end(); 649 } else { 650 op->evaluate(); 651 } 652 653 // Free memory if needed 654 if (op->is_cheap_allocated()) delete op; |