< prev index next >

src/share/vm/runtime/thread.cpp

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


  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/javaClasses.hpp"
  28 #include "classfile/moduleEntry.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "classfile/vmSymbols.hpp"
  31 #include "code/codeCache.hpp"
  32 #include "code/scopeDesc.hpp"
  33 #include "compiler/compileBroker.hpp"
  34 #include "compiler/compileTask.hpp"
  35 #include "gc/shared/gcId.hpp"
  36 #include "gc/shared/gcLocker.inline.hpp"
  37 #include "gc/shared/workgroup.hpp"
  38 #include "interpreter/interpreter.hpp"
  39 #include "interpreter/linkResolver.hpp"
  40 #include "interpreter/oopMapCache.hpp"
  41 #include "jvmtifiles/jvmtiEnv.hpp"
  42 #include "logging/log.hpp"
  43 #include "logging/logConfiguration.hpp"

  44 #include "memory/metaspaceShared.hpp"
  45 #include "memory/oopFactory.hpp"
  46 #include "memory/resourceArea.hpp"
  47 #include "memory/universe.inline.hpp"
  48 #include "oops/instanceKlass.hpp"
  49 #include "oops/objArrayOop.hpp"
  50 #include "oops/oop.inline.hpp"
  51 #include "oops/symbol.hpp"
  52 #include "oops/verifyOopClosure.hpp"
  53 #include "prims/jvm.h"
  54 #include "prims/jvm_misc.hpp"
  55 #include "prims/jvmtiExport.hpp"
  56 #include "prims/jvmtiThreadState.hpp"
  57 #include "prims/privilegedStack.hpp"
  58 #include "runtime/arguments.hpp"
  59 #include "runtime/atomic.hpp"
  60 #include "runtime/biasedLocking.hpp"
  61 #include "runtime/commandLineFlagConstraintList.hpp"
  62 #include "runtime/commandLineFlagWriteableList.hpp"
  63 #include "runtime/commandLineFlagRangeList.hpp"


  94 #include "services/management.hpp"
  95 #include "services/memTracker.hpp"
  96 #include "services/threadService.hpp"
  97 #include "trace/traceMacros.hpp"
  98 #include "trace/tracing.hpp"
  99 #include "utilities/align.hpp"
 100 #include "utilities/defaultStream.hpp"
 101 #include "utilities/dtrace.hpp"
 102 #include "utilities/events.hpp"
 103 #include "utilities/macros.hpp"
 104 #include "utilities/preserveException.hpp"
 105 #include "utilities/vmError.hpp"
 106 #if INCLUDE_ALL_GCS
 107 #include "gc/cms/concurrentMarkSweepThread.hpp"
 108 #include "gc/g1/concurrentMarkThread.inline.hpp"
 109 #include "gc/parallel/pcTasks.hpp"
 110 #endif // INCLUDE_ALL_GCS
 111 #if INCLUDE_JVMCI
 112 #include "jvmci/jvmciCompiler.hpp"
 113 #include "jvmci/jvmciRuntime.hpp"

 114 #endif
 115 #ifdef COMPILER1
 116 #include "c1/c1_Compiler.hpp"
 117 #endif
 118 #ifdef COMPILER2
 119 #include "opto/c2compiler.hpp"
 120 #include "opto/idealGraphPrinter.hpp"
 121 #endif
 122 #if INCLUDE_RTM_OPT
 123 #include "runtime/rtmLocking.hpp"
 124 #endif
 125 
 126 // Initialization after module runtime initialization
 127 void universe_post_module_init();  // must happen after call_initPhase2
 128 
 129 #ifdef DTRACE_ENABLED
 130 
 131 // Only bother with this argument setup if dtrace is available
 132 
 133   #define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START


2086   JavaThread::AsyncRequests condition = clear_special_runtime_exit_condition();
2087   if (condition == _no_async_condition) {
2088     // Conditions have changed since has_special_runtime_exit_condition()
2089     // was called:
2090     // - if we were here only because of an external suspend request,
2091     //   then that was taken care of above (or cancelled) so we are done
2092     // - if we were here because of another async request, then it has
2093     //   been cleared between the has_special_runtime_exit_condition()
2094     //   and now so again we are done
2095     return;
2096   }
2097 
2098   // Check for pending async. exception
2099   if (_pending_async_exception != NULL) {
2100     // Only overwrite an already pending exception, if it is not a threadDeath.
2101     if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) {
2102 
2103       // We cannot call Exceptions::_throw(...) here because we cannot block
2104       set_pending_exception(_pending_async_exception, __FILE__, __LINE__);
2105 
2106       if (log_is_enabled(Info, exceptions)) {

2107         ResourceMark rm;
2108         outputStream* logstream = Log(exceptions)::info_stream();
2109         logstream->print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", p2i(this));
2110           if (has_last_Java_frame()) {
2111             frame f = last_frame();
2112            logstream->print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", p2i(f.pc()), p2i(f.sp()));
2113           }
2114         logstream->print_cr(" of type: %s", _pending_async_exception->klass()->external_name());
2115       }
2116       _pending_async_exception = NULL;
2117       clear_has_async_exception();
2118     }
2119   }
2120 
2121   if (check_unsafe_error &&
2122       condition == _async_unsafe_access_error && !has_pending_exception()) {
2123     condition = _no_async_condition;  // done
2124     switch (thread_state()) {
2125     case _thread_in_vm: {
2126       JavaThread* THREAD = this;
2127       THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
2128     }
2129     case _thread_in_native: {
2130       ThreadInVMfromNative tiv(this);
2131       JavaThread* THREAD = this;
2132       THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
2133     }
2134     case _thread_in_Java: {




  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/javaClasses.hpp"
  28 #include "classfile/moduleEntry.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "classfile/vmSymbols.hpp"
  31 #include "code/codeCache.hpp"
  32 #include "code/scopeDesc.hpp"
  33 #include "compiler/compileBroker.hpp"
  34 #include "compiler/compileTask.hpp"
  35 #include "gc/shared/gcId.hpp"
  36 #include "gc/shared/gcLocker.inline.hpp"
  37 #include "gc/shared/workgroup.hpp"
  38 #include "interpreter/interpreter.hpp"
  39 #include "interpreter/linkResolver.hpp"
  40 #include "interpreter/oopMapCache.hpp"
  41 #include "jvmtifiles/jvmtiEnv.hpp"
  42 #include "logging/log.hpp"
  43 #include "logging/logConfiguration.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "memory/metaspaceShared.hpp"
  46 #include "memory/oopFactory.hpp"
  47 #include "memory/resourceArea.hpp"
  48 #include "memory/universe.inline.hpp"
  49 #include "oops/instanceKlass.hpp"
  50 #include "oops/objArrayOop.hpp"
  51 #include "oops/oop.inline.hpp"
  52 #include "oops/symbol.hpp"
  53 #include "oops/verifyOopClosure.hpp"
  54 #include "prims/jvm.h"
  55 #include "prims/jvm_misc.hpp"
  56 #include "prims/jvmtiExport.hpp"
  57 #include "prims/jvmtiThreadState.hpp"
  58 #include "prims/privilegedStack.hpp"
  59 #include "runtime/arguments.hpp"
  60 #include "runtime/atomic.hpp"
  61 #include "runtime/biasedLocking.hpp"
  62 #include "runtime/commandLineFlagConstraintList.hpp"
  63 #include "runtime/commandLineFlagWriteableList.hpp"
  64 #include "runtime/commandLineFlagRangeList.hpp"


  95 #include "services/management.hpp"
  96 #include "services/memTracker.hpp"
  97 #include "services/threadService.hpp"
  98 #include "trace/traceMacros.hpp"
  99 #include "trace/tracing.hpp"
 100 #include "utilities/align.hpp"
 101 #include "utilities/defaultStream.hpp"
 102 #include "utilities/dtrace.hpp"
 103 #include "utilities/events.hpp"
 104 #include "utilities/macros.hpp"
 105 #include "utilities/preserveException.hpp"
 106 #include "utilities/vmError.hpp"
 107 #if INCLUDE_ALL_GCS
 108 #include "gc/cms/concurrentMarkSweepThread.hpp"
 109 #include "gc/g1/concurrentMarkThread.inline.hpp"
 110 #include "gc/parallel/pcTasks.hpp"
 111 #endif // INCLUDE_ALL_GCS
 112 #if INCLUDE_JVMCI
 113 #include "jvmci/jvmciCompiler.hpp"
 114 #include "jvmci/jvmciRuntime.hpp"
 115 #include "logging/logHandle.hpp"
 116 #endif
 117 #ifdef COMPILER1
 118 #include "c1/c1_Compiler.hpp"
 119 #endif
 120 #ifdef COMPILER2
 121 #include "opto/c2compiler.hpp"
 122 #include "opto/idealGraphPrinter.hpp"
 123 #endif
 124 #if INCLUDE_RTM_OPT
 125 #include "runtime/rtmLocking.hpp"
 126 #endif
 127 
 128 // Initialization after module runtime initialization
 129 void universe_post_module_init();  // must happen after call_initPhase2
 130 
 131 #ifdef DTRACE_ENABLED
 132 
 133 // Only bother with this argument setup if dtrace is available
 134 
 135   #define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START


2088   JavaThread::AsyncRequests condition = clear_special_runtime_exit_condition();
2089   if (condition == _no_async_condition) {
2090     // Conditions have changed since has_special_runtime_exit_condition()
2091     // was called:
2092     // - if we were here only because of an external suspend request,
2093     //   then that was taken care of above (or cancelled) so we are done
2094     // - if we were here because of another async request, then it has
2095     //   been cleared between the has_special_runtime_exit_condition()
2096     //   and now so again we are done
2097     return;
2098   }
2099 
2100   // Check for pending async. exception
2101   if (_pending_async_exception != NULL) {
2102     // Only overwrite an already pending exception, if it is not a threadDeath.
2103     if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) {
2104 
2105       // We cannot call Exceptions::_throw(...) here because we cannot block
2106       set_pending_exception(_pending_async_exception, __FILE__, __LINE__);
2107 
2108       LogTarget(Info, exceptions) lt;
2109       if (lt.is_enabled()) {
2110         ResourceMark rm;
2111         LogStream ls(lt);
2112         ls.print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", p2i(this));
2113           if (has_last_Java_frame()) {
2114             frame f = last_frame();
2115            ls.print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", p2i(f.pc()), p2i(f.sp()));
2116           }
2117         ls.print_cr(" of type: %s", _pending_async_exception->klass()->external_name());
2118       }
2119       _pending_async_exception = NULL;
2120       clear_has_async_exception();
2121     }
2122   }
2123 
2124   if (check_unsafe_error &&
2125       condition == _async_unsafe_access_error && !has_pending_exception()) {
2126     condition = _no_async_condition;  // done
2127     switch (thread_state()) {
2128     case _thread_in_vm: {
2129       JavaThread* THREAD = this;
2130       THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
2131     }
2132     case _thread_in_native: {
2133       ThreadInVMfromNative tiv(this);
2134       JavaThread* THREAD = this;
2135       THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
2136     }
2137     case _thread_in_Java: {


< prev index next >