< prev index next >

src/share/vm/runtime/vm_operations.cpp

Print this page
rev 13113 : imported patch 8181917-refactor-ul-logstream


  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 
  49 void VM_Operation::set_calling_thread(Thread* thread, ThreadPriority priority) {
  50   _calling_thread = thread;
  51   assert(MinPriority <= priority && priority <= MaxPriority, "sanity check");
  52   _priority = priority;
  53 }
  54 
  55 
  56 void VM_Operation::evaluate() {
  57   ResourceMark rm;
  58   outputStream* debugstream;
  59   bool enabled = log_is_enabled(Debug, vmoperation);
  60   if (enabled) {
  61     debugstream = Log(vmoperation)::debug_stream();
  62     debugstream->print("begin ");
  63     print_on_error(debugstream);
  64     debugstream->cr();
  65   }
  66   doit();
  67   if (enabled) {
  68     debugstream->print("end ");
  69     print_on_error(debugstream);
  70     debugstream->cr();

  71   }
  72 }
  73 
  74 const char* VM_Operation::mode_to_string(Mode mode) {
  75   switch(mode) {
  76     case _safepoint      : return "safepoint";
  77     case _no_safepoint   : return "no safepoint";
  78     case _concurrent     : return "concurrent";
  79     case _async_safepoint: return "async safepoint";
  80     default              : return "unknown";
  81   }
  82 }
  83 // Called by fatal error handler.
  84 void VM_Operation::print_on_error(outputStream* st) const {
  85   st->print("VM_Operation (" PTR_FORMAT "): ", p2i(this));
  86   st->print("%s", name());
  87 
  88   const char* mode = mode_to_string(evaluation_mode());
  89   st->print(", mode: %s", mode);
  90 




  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 "logging/logStream.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 
  50 void VM_Operation::set_calling_thread(Thread* thread, ThreadPriority priority) {
  51   _calling_thread = thread;
  52   assert(MinPriority <= priority && priority <= MaxPriority, "sanity check");
  53   _priority = priority;
  54 }
  55 
  56 
  57 void VM_Operation::evaluate() {
  58   ResourceMark rm;
  59   LogTarget(Debug, vmoperation) lt;
  60   if (lt.is_enabled()) {
  61     LogStream ls(lt);
  62     ls.print("begin ");
  63     print_on_error(&ls);
  64     ls.cr();

  65   }
  66   doit();
  67   if (lt.is_enabled()) {
  68     LogStream ls(lt);
  69     ls.print("end ");
  70     print_on_error(&ls);
  71     ls.cr();
  72   }
  73 }
  74 
  75 const char* VM_Operation::mode_to_string(Mode mode) {
  76   switch(mode) {
  77     case _safepoint      : return "safepoint";
  78     case _no_safepoint   : return "no safepoint";
  79     case _concurrent     : return "concurrent";
  80     case _async_safepoint: return "async safepoint";
  81     default              : return "unknown";
  82   }
  83 }
  84 // Called by fatal error handler.
  85 void VM_Operation::print_on_error(outputStream* st) const {
  86   st->print("VM_Operation (" PTR_FORMAT "): ", p2i(this));
  87   st->print("%s", name());
  88 
  89   const char* mode = mode_to_string(evaluation_mode());
  90   st->print(", mode: %s", mode);
  91 


< prev index next >