< prev index next >

src/hotspot/share/utilities/decoder.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -39,18 +39,13 @@
 #endif
 
 AbstractDecoder*  Decoder::_shared_decoder = NULL;
 AbstractDecoder*  Decoder::_error_handler_decoder = NULL;
 NullDecoder       Decoder::_do_nothing_decoder;
-Mutex*            Decoder::_shared_decoder_lock = new Mutex(Mutex::native,
-                                "SharedDecoderLock",
-                                false,
-                                Monitor::_safepoint_check_never);
 
 AbstractDecoder* Decoder::get_shared_instance() {
-  assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(),
-    "Require DecoderLock to enter");
+  assert(shared_decoder_lock()->owned_by_self(), "Require DecoderLock to enter");
 
   if (_shared_decoder == NULL) {
     _shared_decoder = create_decoder();
   }
   return _shared_decoder;

@@ -87,48 +82,49 @@
   return (os::current_thread_id() == VMError::get_first_error_tid());
 }
 
 DecoderLocker::DecoderLocker() :
   MutexLockerEx(DecoderLocker::is_first_error_thread() ?
-                NULL : Decoder::shared_decoder_lock(), true) {
+                NULL : Decoder::shared_decoder_lock(),
+                Mutex::_no_safepoint_check_flag) {
   _decoder = is_first_error_thread() ?
     Decoder::get_error_handler_instance() : Decoder::get_shared_instance();
   assert(_decoder != NULL, "null decoder");
 }
 
 Mutex* Decoder::shared_decoder_lock() {
-  assert(_shared_decoder_lock != NULL, "Just check");
-  return _shared_decoder_lock;
+  assert(Decoder_shared_decoder_lock != NULL, "Just check");
+  return Decoder_shared_decoder_lock;
 }
 
 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
-  assert(_shared_decoder_lock != NULL, "Just check");
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
+  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
+                       Mutex::_no_safepoint_check_flag);
   AbstractDecoder* decoder = error_handling_thread ?
     get_error_handler_instance(): get_shared_instance();
   assert(decoder != NULL, "null decoder");
 
   return decoder->decode(addr, buf, buflen, offset, modulepath, demangle);
 }
 
 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
-  assert(_shared_decoder_lock != NULL, "Just check");
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
+  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
+                       Mutex::_no_safepoint_check_flag);
   AbstractDecoder* decoder = error_handling_thread ?
     get_error_handler_instance(): get_shared_instance();
   assert(decoder != NULL, "null decoder");
 
   return decoder->decode(addr, buf, buflen, offset, base);
 }
 
 
 bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
-  assert(_shared_decoder_lock != NULL, "Just check");
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
+  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
+                       Mutex::_no_safepoint_check_flag);
   AbstractDecoder* decoder = error_handling_thread ?
     get_error_handler_instance(): get_shared_instance();
   assert(decoder != NULL, "null decoder");
   return decoder->demangle(symbol, buf, buflen);
 }
< prev index next >