src/os/aix/vm/osThread_aix.hpp

changeset 0
f90c822e73f8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/os/aix/vm/osThread_aix.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,144 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright 2012, 2013 SAP AG. All rights reserved.
     1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + *
     1.9 + * This code is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License version 2 only, as
    1.11 + * published by the Free Software Foundation.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +#ifndef OS_AIX_VM_OSTHREAD_AIX_HPP
    1.30 +#define OS_AIX_VM_OSTHREAD_AIX_HPP
    1.31 +
    1.32 + public:
    1.33 +  typedef pid_t thread_id_t;
    1.34 +
    1.35 + private:
    1.36 +  int _thread_type;
    1.37 +
    1.38 + public:
    1.39 +
    1.40 +  int thread_type() const {
    1.41 +    return _thread_type;
    1.42 +  }
    1.43 +  void set_thread_type(int type) {
    1.44 +    _thread_type = type;
    1.45 +  }
    1.46 +
    1.47 + private:
    1.48 +
    1.49 +  // _pthread_id is the pthread id, which is used by library calls
    1.50 +  // (e.g. pthread_kill).
    1.51 +  pthread_t _pthread_id;
    1.52 +
    1.53 +  sigset_t _caller_sigmask; // Caller's signal mask
    1.54 +
    1.55 + public:
    1.56 +
    1.57 +  // Methods to save/restore caller's signal mask
    1.58 +  sigset_t  caller_sigmask() const       { return _caller_sigmask; }
    1.59 +  void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
    1.60 +
    1.61 +#ifndef PRODUCT
    1.62 +  // Used for debugging, return a unique integer for each thread.
    1.63 +  int thread_identifier() const   { return _thread_id; }
    1.64 +#endif
    1.65 +#ifdef ASSERT
    1.66 +  // We expect no reposition failures so kill vm if we get one.
    1.67 +  //
    1.68 +  bool valid_reposition_failure() {
    1.69 +    return false;
    1.70 +  }
    1.71 +#endif // ASSERT
    1.72 +  pthread_t pthread_id() const {
    1.73 +    return _pthread_id;
    1.74 +  }
    1.75 +  void set_pthread_id(pthread_t tid) {
    1.76 +    _pthread_id = tid;
    1.77 +  }
    1.78 +
    1.79 +  // ***************************************************************
    1.80 +  // suspension support.
    1.81 +  // ***************************************************************
    1.82 +
    1.83 + public:
    1.84 +  // flags that support signal based suspend/resume on Linux are in a
    1.85 +  // separate class to avoid confusion with many flags in OSThread that
    1.86 +  // are used by VM level suspend/resume.
    1.87 +  os::SuspendResume sr;
    1.88 +
    1.89 +  // _ucontext and _siginfo are used by SR_handler() to save thread context,
    1.90 +  // and they will later be used to walk the stack or reposition thread PC.
    1.91 +  // If the thread is not suspended in SR_handler() (e.g. self suspend),
    1.92 +  // the value in _ucontext is meaningless, so we must use the last Java
    1.93 +  // frame information as the frame. This will mean that for threads
    1.94 +  // that are parked on a mutex the profiler (and safepoint mechanism)
    1.95 +  // will see the thread as if it were still in the Java frame. This
    1.96 +  // not a problem for the profiler since the Java frame is a close
    1.97 +  // enough result. For the safepoint mechanism when the give it the
    1.98 +  // Java frame we are not at a point where the safepoint needs the
    1.99 +  // frame to that accurate (like for a compiled safepoint) since we
   1.100 +  // should be in a place where we are native and will block ourselves
   1.101 +  // if we transition.
   1.102 + private:
   1.103 +  void* _siginfo;
   1.104 +  ucontext_t* _ucontext;
   1.105 +  int _expanding_stack;                 // non zero if manually expanding stack
   1.106 +  address _alt_sig_stack;               // address of base of alternate signal stack
   1.107 +
   1.108 + public:
   1.109 +  void* siginfo() const                   { return _siginfo;  }
   1.110 +  void set_siginfo(void* ptr)             { _siginfo = ptr;   }
   1.111 +  ucontext_t* ucontext() const            { return _ucontext; }
   1.112 +  void set_ucontext(ucontext_t* ptr)      { _ucontext = ptr;  }
   1.113 +  void set_expanding_stack(void)          { _expanding_stack = 1;  }
   1.114 +  void clear_expanding_stack(void)        { _expanding_stack = 0;  }
   1.115 +  int  expanding_stack(void)              { return _expanding_stack;  }
   1.116 +
   1.117 +  void set_alt_sig_stack(address val)     { _alt_sig_stack = val; }
   1.118 +  address alt_sig_stack(void)             { return _alt_sig_stack; }
   1.119 +
   1.120 + private:
   1.121 +  Monitor* _startThread_lock;     // sync parent and child in thread creation
   1.122 +
   1.123 + public:
   1.124 +
   1.125 +  Monitor* startThread_lock() const {
   1.126 +    return _startThread_lock;
   1.127 +  }
   1.128 +
   1.129 +  // ***************************************************************
   1.130 +  // Platform dependent initialization and cleanup
   1.131 +  // ***************************************************************
   1.132 +
   1.133 + private:
   1.134 +
   1.135 +  void pd_initialize();
   1.136 +  void pd_destroy();
   1.137 +
   1.138 + public:
   1.139 +
   1.140 +  // The last measured values of cpu timing to prevent the "stale
   1.141 +  // value return" bug in thread_cpu_time.
   1.142 +  volatile struct {
   1.143 +    jlong sys;
   1.144 +    jlong user;
   1.145 +  } _last_cpu_times;
   1.146 +
   1.147 +#endif // OS_AIX_VM_OSTHREAD_AIX_HPP

mercurial