24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "gc/shared/isGCActiveMark.hpp"
32 #include "logging/log.hpp"
33 #include "logging/logStream.hpp"
34 #include "logging/logConfiguration.hpp"
35 #include "memory/heapInspection.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "memory/universe.hpp"
38 #include "oops/symbol.hpp"
39 #include "runtime/arguments.hpp"
40 #include "runtime/deoptimization.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/interfaceSupport.inline.hpp"
43 #include "runtime/sweeper.hpp"
44 #include "runtime/thread.inline.hpp"
45 #include "runtime/threadSMR.inline.hpp"
46 #include "runtime/vmOperations.hpp"
47 #include "services/threadService.hpp"
48
49 #define VM_OP_NAME_INITIALIZE(name) #name,
50
51 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
52 { VM_OPS_DO(VM_OP_NAME_INITIALIZE) };
53
54 void VM_Operation::set_calling_thread(Thread* thread, ThreadPriority priority) {
55 _calling_thread = thread;
56 assert(MinPriority <= priority && priority <= MaxPriority, "sanity check");
57 _priority = priority;
58 }
59
60
61 void VM_Operation::evaluate() {
62 ResourceMark rm;
63 LogTarget(Debug, vmoperation) lt;
452 #else
453 num_active_compiler_thread++;
454 #endif
455 }
456 }
457 }
458
459 if (num_active == 0) {
460 return 0;
461 } else if (attempts > max_wait) {
462 return num_active;
463 } else if (num_active_compiler_thread == 0 && attempts > max_wait_user_thread) {
464 return num_active;
465 }
466
467 attempts++;
468
469 MonitorLocker ml(&timer, Mutex::_no_safepoint_check_flag);
470 ml.wait(10);
471 }
472 }
473
474 void VM_Exit::doit() {
475
476 if (VerifyBeforeExit) {
477 HandleMark hm(VMThread::vm_thread());
478 // Among other things, this ensures that Eden top is correct.
479 Universe::heap()->prepare_for_verify();
480 // Silent verification so as not to pollute normal output,
481 // unless we really asked for it.
482 Universe::verify();
483 }
484
485 CompileBroker::set_should_block();
486
487 // Wait for a short period for threads in native to block. Any thread
488 // still executing native code after the wait will be stopped at
489 // native==>Java/VM barriers.
490 // Among 16276 JCK tests, 94% of them come here without any threads still
491 // running in native; the other 6% are quiescent within 250ms (Ultra 80).
|
24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "gc/shared/isGCActiveMark.hpp"
32 #include "logging/log.hpp"
33 #include "logging/logStream.hpp"
34 #include "logging/logConfiguration.hpp"
35 #include "memory/heapInspection.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "memory/universe.hpp"
38 #include "oops/symbol.hpp"
39 #include "runtime/arguments.hpp"
40 #include "runtime/deoptimization.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/interfaceSupport.inline.hpp"
43 #include "runtime/sweeper.hpp"
44 #include "runtime/synchronizer.hpp"
45 #include "runtime/thread.inline.hpp"
46 #include "runtime/threadSMR.inline.hpp"
47 #include "runtime/vmOperations.hpp"
48 #include "services/threadService.hpp"
49
50 #define VM_OP_NAME_INITIALIZE(name) #name,
51
52 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
53 { VM_OPS_DO(VM_OP_NAME_INITIALIZE) };
54
55 void VM_Operation::set_calling_thread(Thread* thread, ThreadPriority priority) {
56 _calling_thread = thread;
57 assert(MinPriority <= priority && priority <= MaxPriority, "sanity check");
58 _priority = priority;
59 }
60
61
62 void VM_Operation::evaluate() {
63 ResourceMark rm;
64 LogTarget(Debug, vmoperation) lt;
453 #else
454 num_active_compiler_thread++;
455 #endif
456 }
457 }
458 }
459
460 if (num_active == 0) {
461 return 0;
462 } else if (attempts > max_wait) {
463 return num_active;
464 } else if (num_active_compiler_thread == 0 && attempts > max_wait_user_thread) {
465 return num_active;
466 }
467
468 attempts++;
469
470 MonitorLocker ml(&timer, Mutex::_no_safepoint_check_flag);
471 ml.wait(10);
472 }
473 }
474
475 bool VM_Exit::doit_prologue() {
476 if (AsyncDeflateIdleMonitors) {
477 // AsyncDeflateIdleMonitors does a special deflation at the VM_Exit
478 // safepoint in order to reduce the in-use monitor population that
479 // is reported ObjectSynchronizer::log_in_use_monitor_details() at
480 // VM exit.
481 ObjectSynchronizer::set_is_special_deflation_requested(true);
482 }
483 return true;
484 }
485
486 void VM_Exit::doit() {
487
488 if (VerifyBeforeExit) {
489 HandleMark hm(VMThread::vm_thread());
490 // Among other things, this ensures that Eden top is correct.
491 Universe::heap()->prepare_for_verify();
492 // Silent verification so as not to pollute normal output,
493 // unless we really asked for it.
494 Universe::verify();
495 }
496
497 CompileBroker::set_should_block();
498
499 // Wait for a short period for threads in native to block. Any thread
500 // still executing native code after the wait will be stopped at
501 // native==>Java/VM barriers.
502 // Among 16276 JCK tests, 94% of them come here without any threads still
503 // running in native; the other 6% are quiescent within 250ms (Ultra 80).
|