< prev index next >

src/share/vm/runtime/thread.cpp

Print this page
rev 13105 : imported patch 8181917-refactor-ul-logstream-alt1-callsite-changes


  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_misc.hpp"
  54 #include "prims/jvmtiExport.hpp"
  55 #include "prims/jvmtiThreadState.hpp"
  56 #include "prims/privilegedStack.hpp"
  57 #include "runtime/arguments.hpp"
  58 #include "runtime/atomic.hpp"
  59 #include "runtime/biasedLocking.hpp"
  60 #include "runtime/commandLineFlagConstraintList.hpp"
  61 #include "runtime/commandLineFlagWriteableList.hpp"
  62 #include "runtime/commandLineFlagRangeList.hpp"
  63 #include "runtime/deoptimization.hpp"


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

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


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

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


  92 #include "runtime/vm_version.hpp"
  93 #include "services/attachListener.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/defaultStream.hpp"
 100 #include "utilities/dtrace.hpp"
 101 #include "utilities/events.hpp"
 102 #include "utilities/macros.hpp"
 103 #include "utilities/preserveException.hpp"
 104 #if INCLUDE_ALL_GCS
 105 #include "gc/cms/concurrentMarkSweepThread.hpp"
 106 #include "gc/g1/concurrentMarkThread.inline.hpp"
 107 #include "gc/parallel/pcTasks.hpp"
 108 #endif // INCLUDE_ALL_GCS
 109 #if INCLUDE_JVMCI
 110 #include "jvmci/jvmciCompiler.hpp"
 111 #include "jvmci/jvmciRuntime.hpp"
 112 #include "logging/logHandle.hpp"
 113 #endif
 114 #ifdef COMPILER1
 115 #include "c1/c1_Compiler.hpp"
 116 #endif
 117 #ifdef COMPILER2
 118 #include "opto/c2compiler.hpp"
 119 #include "opto/idealGraphPrinter.hpp"
 120 #endif
 121 #if INCLUDE_RTM_OPT
 122 #include "runtime/rtmLocking.hpp"
 123 #endif
 124 
 125 // Initialization after module runtime initialization
 126 void universe_post_module_init();  // must happen after call_initPhase2
 127 
 128 #ifdef DTRACE_ENABLED
 129 
 130 // Only bother with this argument setup if dtrace is available
 131 
 132   #define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START


2085   JavaThread::AsyncRequests condition = clear_special_runtime_exit_condition();
2086   if (condition == _no_async_condition) {
2087     // Conditions have changed since has_special_runtime_exit_condition()
2088     // was called:
2089     // - if we were here only because of an external suspend request,
2090     //   then that was taken care of above (or cancelled) so we are done
2091     // - if we were here because of another async request, then it has
2092     //   been cleared between the has_special_runtime_exit_condition()
2093     //   and now so again we are done
2094     return;
2095   }
2096 
2097   // Check for pending async. exception
2098   if (_pending_async_exception != NULL) {
2099     // Only overwrite an already pending exception, if it is not a threadDeath.
2100     if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) {
2101 
2102       // We cannot call Exceptions::_throw(...) here because we cannot block
2103       set_pending_exception(_pending_async_exception, __FILE__, __LINE__);
2104 
2105       LogTarget(Info, exceptions) lt;
2106       if (lt.is_enabled()) {
2107         ResourceMark rm;
2108         LogStream ls(lt);
2109         ls.print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", p2i(this));
2110           if (has_last_Java_frame()) {
2111             frame f = last_frame();
2112            ls.print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", p2i(f.pc()), p2i(f.sp()));
2113           }
2114         ls.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: {


< prev index next >