< prev index next >

src/share/vm/runtime/thread.hpp

Print this page
rev 8910 : full patch for jfr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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.

@@ -193,11 +193,12 @@
     _external_suspend       = 0x20000000U, // thread is asked to self suspend
     _ext_suspended          = 0x40000000U, // thread has self-suspended
     _deopt_suspend          = 0x10000000U, // thread needs to self suspend for deopt
 
     _has_async_exception    = 0x00000001U, // there is a pending async exception
-    _critical_native_unlock = 0x00000002U  // Must call back to unlock JNI critical lock
+    _critical_native_unlock = 0x00000002U, // Must call back to unlock JNI critical lock
+    _trace_flag             = 0x00000004U  // call tracing backend
   };
 
   // various suspension related flags - atomically updated
   // overloaded for async exception checking in check_special_condition_for_native_trans.
   volatile uint32_t _suspend_flags;

@@ -258,11 +259,11 @@
                                                 // the Java heap
 
   // Thread-local buffer used by MetadataOnStackMark.
   MetadataOnStackBuffer* _metadata_on_stack_buffer;
 
-  TRACE_DATA _trace_data;                       // Thread-local data for tracing
+  mutable TRACE_DATA _trace_data;                       // Thread-local data for tracing
 
   ThreadExt _ext;
 
   int   _vm_operation_started_count;            // VM_Operation support
   int   _vm_operation_completed_count;          // VM_Operation support

@@ -381,10 +382,18 @@
   }
   void clear_critical_native_unlock() {
     clear_suspend_flag(_critical_native_unlock);
   }
 
+  void set_trace_flag() {
+    set_suspend_flag(_trace_flag);
+  }
+
+  void clear_trace_flag() {
+    clear_suspend_flag(_trace_flag);
+  }
+
   // Support for Unhandled Oop detection
 #ifdef CHECK_UNHANDLED_OOPS
  private:
   UnhandledOops* _unhandled_oops;
  public:

@@ -439,11 +448,13 @@
   jlong allocated_bytes()               { return _allocated_bytes; }
   void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
   void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
   inline jlong cooked_allocated_bytes();
 
-  TRACE_DATA* trace_data()              { return &_trace_data; }
+  TRACE_DEFINE_THREAD_TRACE_DATA_OFFSET;
+  TRACE_DATA* trace_data() const             { return &_trace_data; }
+  bool is_trace_suspend()               { return (_suspend_flags & _trace_flag) != 0; }
 
   const ThreadExt& ext() const          { return _ext; }
   ThreadExt& ext()                      { return _ext; }
 
   // VM operation support
< prev index next >