src/os/bsd/vm/osThread_bsd.hpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
   1 /*
   2  * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  77 
  78   pthread_t pthread_id() const {
  79     return _pthread_id;
  80   }
  81   void set_pthread_id(pthread_t tid) {
  82     _pthread_id = tid;
  83   }
  84 
  85   void set_unique_thread_id(uint64_t id) {
  86     _unique_thread_id = id;
  87   }
  88 
  89   // ***************************************************************
  90   // suspension support.
  91   // ***************************************************************
  92 
  93 public:
  94   // flags that support signal based suspend/resume on Bsd are in a
  95   // separate class to avoid confusion with many flags in OSThread that
  96   // are used by VM level suspend/resume.
  97   os::Bsd::SuspendResume sr;
  98 
  99   // _ucontext and _siginfo are used by SR_handler() to save thread context,
 100   // and they will later be used to walk the stack or reposition thread PC.
 101   // If the thread is not suspended in SR_handler() (e.g. self suspend),
 102   // the value in _ucontext is meaningless, so we must use the last Java
 103   // frame information as the frame. This will mean that for threads
 104   // that are parked on a mutex the profiler (and safepoint mechanism)
 105   // will see the thread as if it were still in the Java frame. This
 106   // not a problem for the profiler since the Java frame is a close
 107   // enough result. For the safepoint mechanism when the give it the
 108   // Java frame we are not at a point where the safepoint needs the
 109   // frame to that accurate (like for a compiled safepoint) since we
 110   // should be in a place where we are native and will block ourselves
 111   // if we transition.
 112 private:
 113   void* _siginfo;
 114   ucontext_t* _ucontext;
 115   int _expanding_stack;                 /* non zero if manually expanding stack */
 116   address _alt_sig_stack;               /* address of base of alternate signal stack */
 117 


   1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  77 
  78   pthread_t pthread_id() const {
  79     return _pthread_id;
  80   }
  81   void set_pthread_id(pthread_t tid) {
  82     _pthread_id = tid;
  83   }
  84 
  85   void set_unique_thread_id(uint64_t id) {
  86     _unique_thread_id = id;
  87   }
  88 
  89   // ***************************************************************
  90   // suspension support.
  91   // ***************************************************************
  92 
  93 public:
  94   // flags that support signal based suspend/resume on Bsd are in a
  95   // separate class to avoid confusion with many flags in OSThread that
  96   // are used by VM level suspend/resume.
  97   os::SuspendResume sr;
  98 
  99   // _ucontext and _siginfo are used by SR_handler() to save thread context,
 100   // and they will later be used to walk the stack or reposition thread PC.
 101   // If the thread is not suspended in SR_handler() (e.g. self suspend),
 102   // the value in _ucontext is meaningless, so we must use the last Java
 103   // frame information as the frame. This will mean that for threads
 104   // that are parked on a mutex the profiler (and safepoint mechanism)
 105   // will see the thread as if it were still in the Java frame. This
 106   // not a problem for the profiler since the Java frame is a close
 107   // enough result. For the safepoint mechanism when the give it the
 108   // Java frame we are not at a point where the safepoint needs the
 109   // frame to that accurate (like for a compiled safepoint) since we
 110   // should be in a place where we are native and will block ourselves
 111   // if we transition.
 112 private:
 113   void* _siginfo;
 114   ucontext_t* _ucontext;
 115   int _expanding_stack;                 /* non zero if manually expanding stack */
 116   address _alt_sig_stack;               /* address of base of alternate signal stack */
 117