hotspot/src/share/vm/runtime/vm_operations.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File jdk9-opensource-openjdk Sdiff hotspot/src/share/vm/runtime

hotspot/src/share/vm/runtime/vm_operations.cpp

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "code/codeCacheExtensions.hpp"
  30 #include "compiler/compileBroker.hpp"
  31 #include "gc/shared/isGCActiveMark.hpp"
  32 #include "logging/log.hpp"
  33 #include "memory/heapInspection.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "oops/symbol.hpp"
  36 #include "runtime/arguments.hpp"
  37 #include "runtime/deoptimization.hpp"
  38 #include "runtime/interfaceSupport.hpp"
  39 #include "runtime/sweeper.hpp"
  40 #include "runtime/thread.inline.hpp"
  41 #include "runtime/vm_operations.hpp"
  42 #include "services/threadService.hpp"
  43 #include "trace/tracing.hpp"
  44 
  45 #define VM_OP_NAME_INITIALIZE(name) #name,
  46 
  47 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
  48   { VM_OPS_DO(VM_OP_NAME_INITIALIZE) };
  49 


 373       if (_with_locked_synchronizers) {
 374         tcl = concurrent_locks.thread_concurrent_locks(jt);
 375       }
 376       ThreadSnapshot* ts = snapshot_thread(jt, tcl);
 377       _result->add_thread_snapshot(ts);
 378     }
 379   }
 380 }
 381 
 382 ThreadSnapshot* VM_ThreadDump::snapshot_thread(JavaThread* java_thread, ThreadConcurrentLocks* tcl) {
 383   ThreadSnapshot* snapshot = new ThreadSnapshot(java_thread);
 384   snapshot->dump_stack_at_safepoint(_max_depth, _with_locked_monitors);
 385   snapshot->set_concurrent_locks(tcl);
 386   return snapshot;
 387 }
 388 
 389 volatile bool VM_Exit::_vm_exited = false;
 390 Thread * VM_Exit::_shutdown_thread = NULL;
 391 
 392 int VM_Exit::set_vm_exited() {
 393   CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::LastStep);
 394 
 395   Thread * thr_cur = Thread::current();
 396 
 397   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
 398 
 399   int num_active = 0;
 400 
 401   _shutdown_thread = thr_cur;
 402   _vm_exited = true;                                // global flag
 403   for(JavaThread *thr = Threads::first(); thr != NULL; thr = thr->next())
 404     if (thr!=thr_cur && thr->thread_state() == _thread_in_native) {
 405       ++num_active;
 406       thr->set_terminated(JavaThread::_vm_exited);  // per-thread flag
 407     }
 408 
 409   return num_active;
 410 }
 411 
 412 int VM_Exit::wait_for_threads_in_native_to_block() {
 413   // VM exits at safepoint. This function must be called at the final safepoint




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  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/isGCActiveMark.hpp"
  31 #include "logging/log.hpp"
  32 #include "memory/heapInspection.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "oops/symbol.hpp"
  35 #include "runtime/arguments.hpp"
  36 #include "runtime/deoptimization.hpp"
  37 #include "runtime/interfaceSupport.hpp"
  38 #include "runtime/sweeper.hpp"
  39 #include "runtime/thread.inline.hpp"
  40 #include "runtime/vm_operations.hpp"
  41 #include "services/threadService.hpp"
  42 #include "trace/tracing.hpp"
  43 
  44 #define VM_OP_NAME_INITIALIZE(name) #name,
  45 
  46 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
  47   { VM_OPS_DO(VM_OP_NAME_INITIALIZE) };
  48 


 372       if (_with_locked_synchronizers) {
 373         tcl = concurrent_locks.thread_concurrent_locks(jt);
 374       }
 375       ThreadSnapshot* ts = snapshot_thread(jt, tcl);
 376       _result->add_thread_snapshot(ts);
 377     }
 378   }
 379 }
 380 
 381 ThreadSnapshot* VM_ThreadDump::snapshot_thread(JavaThread* java_thread, ThreadConcurrentLocks* tcl) {
 382   ThreadSnapshot* snapshot = new ThreadSnapshot(java_thread);
 383   snapshot->dump_stack_at_safepoint(_max_depth, _with_locked_monitors);
 384   snapshot->set_concurrent_locks(tcl);
 385   return snapshot;
 386 }
 387 
 388 volatile bool VM_Exit::_vm_exited = false;
 389 Thread * VM_Exit::_shutdown_thread = NULL;
 390 
 391 int VM_Exit::set_vm_exited() {

 392 
 393   Thread * thr_cur = Thread::current();
 394 
 395   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
 396 
 397   int num_active = 0;
 398 
 399   _shutdown_thread = thr_cur;
 400   _vm_exited = true;                                // global flag
 401   for(JavaThread *thr = Threads::first(); thr != NULL; thr = thr->next())
 402     if (thr!=thr_cur && thr->thread_state() == _thread_in_native) {
 403       ++num_active;
 404       thr->set_terminated(JavaThread::_vm_exited);  // per-thread flag
 405     }
 406 
 407   return num_active;
 408 }
 409 
 410 int VM_Exit::wait_for_threads_in_native_to_block() {
 411   // VM exits at safepoint. This function must be called at the final safepoint


hotspot/src/share/vm/runtime/vm_operations.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File