src/hotspot/share/runtime/safepoint.cpp
changeset 49061 a6b6a428c915
parent 48472 de2e4ff493bf
child 49169 af8578e25d17
equal deleted inserted replaced
49060:76960a347f10 49061:a6b6a428c915
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   891   assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
   891   assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
   892   if (!ThreadLocalHandshakes) {
   892   if (!ThreadLocalHandshakes) {
   893     assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
   893     assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
   894   }
   894   }
   895 
   895 
   896   if (ShowSafepointMsgs) {
       
   897     tty->print("handle_polling_page_exception: ");
       
   898   }
       
   899 
       
   900   if (PrintSafepointStatistics) {
   896   if (PrintSafepointStatistics) {
   901     inc_page_trap_count();
   897     inc_page_trap_count();
   902   }
   898   }
   903 
   899 
   904   ThreadSafepointState* state = thread->safepoint_state();
   900   ThreadSafepointState* state = thread->safepoint_state();
  1096   suspend_type t = type();
  1092   suspend_type t = type();
  1097   assert(!SafepointMechanism::uses_global_page_poll() || t == ThreadSafepointState::_running,
  1093   assert(!SafepointMechanism::uses_global_page_poll() || t == ThreadSafepointState::_running,
  1098          "polling page exception on thread not running state: %u", uint(t));
  1094          "polling page exception on thread not running state: %u", uint(t));
  1099 
  1095 
  1100   // Step 1: Find the nmethod from the return address
  1096   // Step 1: Find the nmethod from the return address
  1101   if (ShowSafepointMsgs && Verbose) {
       
  1102     tty->print_cr("Polling page exception at " INTPTR_FORMAT, p2i(thread()->saved_exception_pc()));
       
  1103   }
       
  1104   address real_return_addr = thread()->saved_exception_pc();
  1097   address real_return_addr = thread()->saved_exception_pc();
  1105 
  1098 
  1106   CodeBlob *cb = CodeCache::find_blob(real_return_addr);
  1099   CodeBlob *cb = CodeCache::find_blob(real_return_addr);
  1107   assert(cb != NULL && cb->is_compiled(), "return address should be in nmethod");
  1100   assert(cb != NULL && cb->is_compiled(), "return address should be in nmethod");
  1108   CompiledMethod* nm = (CompiledMethod*)cb;
  1101   CompiledMethod* nm = (CompiledMethod*)cb;
  1419                 (int64_t)(_max_sync_time / MICROUNITS));
  1412                 (int64_t)(_max_sync_time / MICROUNITS));
  1420   tty->print_cr("Maximum vm operation time (except for Exit VM operation)  "
  1413   tty->print_cr("Maximum vm operation time (except for Exit VM operation)  "
  1421                 INT64_FORMAT_W(5) " ms",
  1414                 INT64_FORMAT_W(5) " ms",
  1422                 (int64_t)(_max_vmop_time / MICROUNITS));
  1415                 (int64_t)(_max_vmop_time / MICROUNITS));
  1423 }
  1416 }
  1424 
       
  1425 // ------------------------------------------------------------------------------------------------
       
  1426 // Non-product code
       
  1427 
       
  1428 #ifndef PRODUCT
       
  1429 
       
  1430 void SafepointSynchronize::print_state() {
       
  1431   if (_state == _not_synchronized) {
       
  1432     tty->print_cr("not synchronized");
       
  1433   } else if (_state == _synchronizing || _state == _synchronized) {
       
  1434     tty->print_cr("State: %s", (_state == _synchronizing) ? "synchronizing" :
       
  1435                   "synchronized");
       
  1436 
       
  1437     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
       
  1438        cur->safepoint_state()->print();
       
  1439     }
       
  1440   }
       
  1441 }
       
  1442 
       
  1443 void SafepointSynchronize::safepoint_msg(const char* format, ...) {
       
  1444   if (ShowSafepointMsgs) {
       
  1445     va_list ap;
       
  1446     va_start(ap, format);
       
  1447     tty->vprint_cr(format, ap);
       
  1448     va_end(ap);
       
  1449   }
       
  1450 }
       
  1451 
       
  1452 #endif // !PRODUCT