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) {
55 _calling_thread = thread;
56 }
57
58 void VM_Operation::evaluate() {
59 ResourceMark rm;
60 LogTarget(Debug, vmoperation) lt;
61 if (lt.is_enabled()) {
62 LogStream ls(lt);
63 ls.print("begin ");
439 #endif
440 }
441 }
442 }
443
444 if (num_active == 0) {
445 return 0;
446 } else if (attempts > max_wait) {
447 return num_active;
448 } else if (num_active_compiler_thread == 0 && attempts > max_wait_user_thread) {
449 return num_active;
450 }
451
452 attempts++;
453
454 MonitorLocker ml(&timer, Mutex::_no_safepoint_check_flag);
455 ml.wait(10);
456 }
457 }
458
459 void VM_Exit::doit() {
460
461 if (VerifyBeforeExit) {
462 HandleMark hm(VMThread::vm_thread());
463 // Among other things, this ensures that Eden top is correct.
464 Universe::heap()->prepare_for_verify();
465 // Silent verification so as not to pollute normal output,
466 // unless we really asked for it.
467 Universe::verify();
468 }
469
470 CompileBroker::set_should_block();
471
472 // Wait for a short period for threads in native to block. Any thread
473 // still executing native code after the wait will be stopped at
474 // native==>Java/VM barriers.
475 // Among 16276 JCK tests, 94% of them come here without any threads still
476 // running in native; the other 6% are quiescent within 250ms (Ultra 80).
477 wait_for_threads_in_native_to_block();
478
|
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) {
56 _calling_thread = thread;
57 }
58
59 void VM_Operation::evaluate() {
60 ResourceMark rm;
61 LogTarget(Debug, vmoperation) lt;
62 if (lt.is_enabled()) {
63 LogStream ls(lt);
64 ls.print("begin ");
440 #endif
441 }
442 }
443 }
444
445 if (num_active == 0) {
446 return 0;
447 } else if (attempts > max_wait) {
448 return num_active;
449 } else if (num_active_compiler_thread == 0 && attempts > max_wait_user_thread) {
450 return num_active;
451 }
452
453 attempts++;
454
455 MonitorLocker ml(&timer, Mutex::_no_safepoint_check_flag);
456 ml.wait(10);
457 }
458 }
459
460 bool VM_Exit::doit_prologue() {
461 if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
462 // AsyncDeflateIdleMonitors does a special deflation at the VM_Exit
463 // safepoint in order to reduce the in-use monitor population that
464 // is reported by ObjectSynchronizer::log_in_use_monitor_details()
465 // at VM exit.
466 ObjectSynchronizer::set_is_special_deflation_requested(true);
467 }
468 return true;
469 }
470
471 void VM_Exit::doit() {
472
473 if (VerifyBeforeExit) {
474 HandleMark hm(VMThread::vm_thread());
475 // Among other things, this ensures that Eden top is correct.
476 Universe::heap()->prepare_for_verify();
477 // Silent verification so as not to pollute normal output,
478 // unless we really asked for it.
479 Universe::verify();
480 }
481
482 CompileBroker::set_should_block();
483
484 // Wait for a short period for threads in native to block. Any thread
485 // still executing native code after the wait will be stopped at
486 // native==>Java/VM barriers.
487 // Among 16276 JCK tests, 94% of them come here without any threads still
488 // running in native; the other 6% are quiescent within 250ms (Ultra 80).
489 wait_for_threads_in_native_to_block();
490
|