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