hotspot/src/share/vm/utilities/decoder.cpp
changeset 22838 82c7497fbad4
parent 22827 07d991d45a51
parent 19952 bc974e92f881
child 22872 b6902ee5bc8d
equal deleted inserted replaced
22837:feba5d4126b8 22838:82c7497fbad4
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "prims/jvm.h"
    26 #include "prims/jvm.h"
    27 #include "runtime/mutexLocker.hpp"
       
    28 #include "runtime/os.hpp"
    27 #include "runtime/os.hpp"
    29 #include "utilities/decoder.hpp"
    28 #include "utilities/decoder.hpp"
    30 #include "utilities/vmError.hpp"
    29 #include "utilities/vmError.hpp"
    31 
    30 
    32 #if defined(_WINDOWS)
    31 #if defined(_WINDOWS)
    80       delete decoder;
    79       delete decoder;
    81     }
    80     }
    82     decoder = &_do_nothing_decoder;
    81     decoder = &_do_nothing_decoder;
    83   }
    82   }
    84   return decoder;
    83   return decoder;
       
    84 }
       
    85 
       
    86 inline bool DecoderLocker::is_first_error_thread() {
       
    87   return (os::current_thread_id() == VMError::get_first_error_tid());
       
    88 }
       
    89 
       
    90 DecoderLocker::DecoderLocker() :
       
    91   MutexLockerEx(DecoderLocker::is_first_error_thread() ?
       
    92                 NULL : Decoder::shared_decoder_lock(), true) {
       
    93   _decoder = is_first_error_thread() ?
       
    94     Decoder::get_error_handler_instance() : Decoder::get_shared_instance();
       
    95   assert(_decoder != NULL, "null decoder");
       
    96 }
       
    97 
       
    98 Mutex* Decoder::shared_decoder_lock() {
       
    99   assert(_shared_decoder_lock != NULL, "Just check");
       
   100   return _shared_decoder_lock;
    85 }
   101 }
    86 
   102 
    87 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
   103 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
    88   assert(_shared_decoder_lock != NULL, "Just check");
   104   assert(_shared_decoder_lock != NULL, "Just check");
    89   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
   105   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;