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