Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/aix/vm/osThread_aix.hpp
32284 views
/*1* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.2* Copyright 2012, 2013 SAP AG. 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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef OS_AIX_VM_OSTHREAD_AIX_HPP26#define OS_AIX_VM_OSTHREAD_AIX_HPP2728public:29typedef pid_t thread_id_t;3031private:32int _thread_type;3334public:3536int thread_type() const {37return _thread_type;38}39void set_thread_type(int type) {40_thread_type = type;41}4243private:4445// _pthread_id is the pthread id, which is used by library calls46// (e.g. pthread_kill).47pthread_t _pthread_id;4849sigset_t _caller_sigmask; // Caller's signal mask5051public:5253// Methods to save/restore caller's signal mask54sigset_t caller_sigmask() const { return _caller_sigmask; }55void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }5657#ifndef PRODUCT58// Used for debugging, return a unique integer for each thread.59int thread_identifier() const { return _thread_id; }60#endif61#ifdef ASSERT62// We expect no reposition failures so kill vm if we get one.63//64bool valid_reposition_failure() {65return false;66}67#endif // ASSERT68pthread_t pthread_id() const {69return _pthread_id;70}71void set_pthread_id(pthread_t tid) {72_pthread_id = tid;73}7475// ***************************************************************76// suspension support.77// ***************************************************************7879public:80// flags that support signal based suspend/resume on Linux are in a81// separate class to avoid confusion with many flags in OSThread that82// are used by VM level suspend/resume.83os::SuspendResume sr;8485// _ucontext and _siginfo are used by SR_handler() to save thread context,86// and they will later be used to walk the stack or reposition thread PC.87// If the thread is not suspended in SR_handler() (e.g. self suspend),88// the value in _ucontext is meaningless, so we must use the last Java89// frame information as the frame. This will mean that for threads90// that are parked on a mutex the profiler (and safepoint mechanism)91// will see the thread as if it were still in the Java frame. This92// not a problem for the profiler since the Java frame is a close93// enough result. For the safepoint mechanism when the give it the94// Java frame we are not at a point where the safepoint needs the95// frame to that accurate (like for a compiled safepoint) since we96// should be in a place where we are native and will block ourselves97// if we transition.98private:99void* _siginfo;100ucontext_t* _ucontext;101int _expanding_stack; // non zero if manually expanding stack102address _alt_sig_stack; // address of base of alternate signal stack103104public:105void* siginfo() const { return _siginfo; }106void set_siginfo(void* ptr) { _siginfo = ptr; }107ucontext_t* ucontext() const { return _ucontext; }108void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; }109void set_expanding_stack(void) { _expanding_stack = 1; }110void clear_expanding_stack(void) { _expanding_stack = 0; }111int expanding_stack(void) { return _expanding_stack; }112113void set_alt_sig_stack(address val) { _alt_sig_stack = val; }114address alt_sig_stack(void) { return _alt_sig_stack; }115116private:117Monitor* _startThread_lock; // sync parent and child in thread creation118119public:120121Monitor* startThread_lock() const {122return _startThread_lock;123}124125// ***************************************************************126// Platform dependent initialization and cleanup127// ***************************************************************128129private:130131void pd_initialize();132void pd_destroy();133134public:135136// The last measured values of cpu timing to prevent the "stale137// value return" bug in thread_cpu_time.138volatile struct {139jlong sys;140jlong user;141} _last_cpu_times;142143#endif // OS_AIX_VM_OSTHREAD_AIX_HPP144145146