src/os/aix/vm/osThread_aix.hpp

Wed, 31 Jan 2018 19:24:57 -0500

author
dbuck
date
Wed, 31 Jan 2018 19:24:57 -0500
changeset 9289
427b2fb1944f
parent 0
f90c822e73f8
permissions
-rw-r--r--

8189170: Add option to disable stack overflow checking in primordial thread for use with JNI_CreateJavaJVM
Reviewed-by: dcubed

     1 /*
     2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright 2012, 2013 SAP AG. All rights reserved.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5  *
     6  * This code is free software; you can redistribute it and/or modify it
     7  * under the terms of the GNU General Public License version 2 only, as
     8  * published by the Free Software Foundation.
     9  *
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    13  * version 2 for more details (a copy is included in the LICENSE file that
    14  * accompanied this code).
    15  *
    16  * You should have received a copy of the GNU General Public License version
    17  * 2 along with this work; if not, write to the Free Software Foundation,
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    19  *
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * or visit www.oracle.com if you need additional information or have any
    22  * questions.
    23  *
    24  */
    26 #ifndef OS_AIX_VM_OSTHREAD_AIX_HPP
    27 #define OS_AIX_VM_OSTHREAD_AIX_HPP
    29  public:
    30   typedef pid_t thread_id_t;
    32  private:
    33   int _thread_type;
    35  public:
    37   int thread_type() const {
    38     return _thread_type;
    39   }
    40   void set_thread_type(int type) {
    41     _thread_type = type;
    42   }
    44  private:
    46   // _pthread_id is the pthread id, which is used by library calls
    47   // (e.g. pthread_kill).
    48   pthread_t _pthread_id;
    50   sigset_t _caller_sigmask; // Caller's signal mask
    52  public:
    54   // Methods to save/restore caller's signal mask
    55   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
    56   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
    58 #ifndef PRODUCT
    59   // Used for debugging, return a unique integer for each thread.
    60   int thread_identifier() const   { return _thread_id; }
    61 #endif
    62 #ifdef ASSERT
    63   // We expect no reposition failures so kill vm if we get one.
    64   //
    65   bool valid_reposition_failure() {
    66     return false;
    67   }
    68 #endif // ASSERT
    69   pthread_t pthread_id() const {
    70     return _pthread_id;
    71   }
    72   void set_pthread_id(pthread_t tid) {
    73     _pthread_id = tid;
    74   }
    76   // ***************************************************************
    77   // suspension support.
    78   // ***************************************************************
    80  public:
    81   // flags that support signal based suspend/resume on Linux are in a
    82   // separate class to avoid confusion with many flags in OSThread that
    83   // are used by VM level suspend/resume.
    84   os::SuspendResume sr;
    86   // _ucontext and _siginfo are used by SR_handler() to save thread context,
    87   // and they will later be used to walk the stack or reposition thread PC.
    88   // If the thread is not suspended in SR_handler() (e.g. self suspend),
    89   // the value in _ucontext is meaningless, so we must use the last Java
    90   // frame information as the frame. This will mean that for threads
    91   // that are parked on a mutex the profiler (and safepoint mechanism)
    92   // will see the thread as if it were still in the Java frame. This
    93   // not a problem for the profiler since the Java frame is a close
    94   // enough result. For the safepoint mechanism when the give it the
    95   // Java frame we are not at a point where the safepoint needs the
    96   // frame to that accurate (like for a compiled safepoint) since we
    97   // should be in a place where we are native and will block ourselves
    98   // if we transition.
    99  private:
   100   void* _siginfo;
   101   ucontext_t* _ucontext;
   102   int _expanding_stack;                 // non zero if manually expanding stack
   103   address _alt_sig_stack;               // address of base of alternate signal stack
   105  public:
   106   void* siginfo() const                   { return _siginfo;  }
   107   void set_siginfo(void* ptr)             { _siginfo = ptr;   }
   108   ucontext_t* ucontext() const            { return _ucontext; }
   109   void set_ucontext(ucontext_t* ptr)      { _ucontext = ptr;  }
   110   void set_expanding_stack(void)          { _expanding_stack = 1;  }
   111   void clear_expanding_stack(void)        { _expanding_stack = 0;  }
   112   int  expanding_stack(void)              { return _expanding_stack;  }
   114   void set_alt_sig_stack(address val)     { _alt_sig_stack = val; }
   115   address alt_sig_stack(void)             { return _alt_sig_stack; }
   117  private:
   118   Monitor* _startThread_lock;     // sync parent and child in thread creation
   120  public:
   122   Monitor* startThread_lock() const {
   123     return _startThread_lock;
   124   }
   126   // ***************************************************************
   127   // Platform dependent initialization and cleanup
   128   // ***************************************************************
   130  private:
   132   void pd_initialize();
   133   void pd_destroy();
   135  public:
   137   // The last measured values of cpu timing to prevent the "stale
   138   // value return" bug in thread_cpu_time.
   139   volatile struct {
   140     jlong sys;
   141     jlong user;
   142   } _last_cpu_times;
   144 #endif // OS_AIX_VM_OSTHREAD_AIX_HPP

mercurial