Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions src/hotspot/os/aix/osThread_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,28 @@
*
*/

// no precompiled headers

#include "memory/allocation.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.hpp"
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "runtime/mutex.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/vmThread.hpp"

void OSThread::pd_initialize() {
_thread_id = 0;
_kernel_thread_id = 0;
_siginfo = nullptr;
_ucontext = nullptr;
_expanding_stack = 0;
_alt_sig_stack = nullptr;

_last_cpu_times.sys = _last_cpu_times.user = 0L;
#include <signal.h>

OSThread::OSThread()
: _thread_id(0),
_thread_type(),
_kernel_thread_id(0),
_caller_sigmask(),
sr(),
_siginfo(nullptr),
_ucontext(nullptr),
_expanding_stack(0),
_alt_sig_stack(nullptr),
_last_cpu_times(),
_startThread_lock(new Monitor(Mutex::event, "startThread_lock")) {
sigemptyset(&_caller_sigmask);

_startThread_lock = new Monitor(Mutex::event, "startThread_lock");
assert(_startThread_lock != nullptr, "check");
}

void OSThread::pd_destroy() {
OSThread::~OSThread() {
delete _startThread_lock;
}
61 changes: 31 additions & 30 deletions src/hotspot/os/aix/osThread_aix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,17 @@
#ifndef OS_AIX_OSTHREAD_AIX_HPP
#define OS_AIX_OSTHREAD_AIX_HPP

public:
typedef pthread_t thread_id_t;

private:
int _thread_type;
#include "runtime/osThreadBase.hpp"
#include "suspendResume_posix.hpp"
#include "utilities/globalDefinitions.hpp"

public:
class OSThread : public OSThreadBase {
friend class VMStructs;

int thread_type() const {
return _thread_type;
}
void set_thread_type(int type) {
_thread_type = type;
}
typedef pthread_t thread_id_t;

private:
thread_id_t _thread_id;
int _thread_type;

// On AIX, we use the pthread id as OSThread::thread_id and keep the kernel thread id
// separately for diagnostic purposes.
Expand All @@ -54,15 +49,27 @@
sigset_t _caller_sigmask; // Caller's signal mask

public:
OSThread();
~OSThread();

int thread_type() const {
return _thread_type;
}
void set_thread_type(int type) {
_thread_type = type;
}

// Methods to save/restore caller's signal mask
sigset_t caller_sigmask() const { return _caller_sigmask; }
void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }

#ifndef PRODUCT
// Used for debugging, return a unique integer for each thread.
int thread_identifier() const { return _thread_id; }
#endif
thread_id_t thread_id() const {
return _thread_id;
}
void set_thread_id(thread_id_t id) {
_thread_id = id;
}

tid_t kernel_thread_id() const {
return _kernel_thread_id;
}
Expand All @@ -71,15 +78,14 @@
}

pthread_t pthread_id() const {
// Here: same as OSThread::thread_id()
// Here: same as thread_id()
return _thread_id;
}

// ***************************************************************
// suspension support.
// ***************************************************************

public:
// flags that support signal based suspend/resume on Aix are in a
// separate class to avoid confusion with many flags in OSThread that
// are used by VM level suspend/resume.
Expand Down Expand Up @@ -125,22 +131,17 @@
return _startThread_lock;
}

// ***************************************************************
// Platform dependent initialization and cleanup
// ***************************************************************

private:

void pd_initialize();
void pd_destroy();

public:

// The last measured values of cpu timing to prevent the "stale
// value return" bug in thread_cpu_time.
volatile struct {
jlong sys;
jlong user;
} _last_cpu_times;

// Printing
uintx thread_id_for_printing() const override {
return (uintx)_thread_id;
}
};

#endif // OS_AIX_OSTHREAD_AIX_HPP
17 changes: 14 additions & 3 deletions src/hotspot/os/aix/vmStructs_aix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@
// constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp.

#define VM_STRUCTS_OS(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)

#define VM_TYPES_OS(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
#define VM_STRUCTS_OS(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\
/******************************/ \
/* Threads (NOTE: incomplete) */ \
/******************************/ \
nonstatic_field(OSThread, _thread_id, pthread_t) \

#define VM_TYPES_OS(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\
/**********************/ \
/* Posix Thread IDs */ \
/**********************/ \
\
declare_unsigned_integer_type(pthread_t)

#define VM_INT_CONSTANTS_OS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)

Expand Down
36 changes: 19 additions & 17 deletions src/hotspot/os/bsd/osThread_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,32 @@
*
*/

// no precompiled headers
#include "memory/allocation.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "runtime/mutex.hpp"
#include "runtime/osThread.hpp"

#include <signal.h>

void OSThread::pd_initialize() {
OSThread::OSThread()
: _thread_id(
#ifdef __APPLE__
_thread_id = 0;
0
#else
_thread_id = nullptr;
nullptr
#endif
_unique_thread_id = 0;
_pthread_id = nullptr;
_siginfo = nullptr;
_ucontext = nullptr;
_expanding_stack = 0;
_alt_sig_stack = nullptr;

),
_thread_type(),
_pthread_id(nullptr),
_unique_thread_id(0),
_caller_sigmask(),
sr(),
_siginfo(nullptr),
_ucontext(nullptr),
_expanding_stack(0),
_alt_sig_stack(nullptr),
_startThread_lock(new Monitor(Mutex::event, "startThread_lock")) {
sigemptyset(&_caller_sigmask);

_startThread_lock = new Monitor(Mutex::event, "startThread_lock");
assert(_startThread_lock !=nullptr, "check");
}

// Additional thread_id used to correlate threads in SA
Expand All @@ -64,6 +66,6 @@ void OSThread::set_unique_thread_id() {
#endif
}

void OSThread::pd_destroy() {
OSThread::~OSThread() {
delete _startThread_lock;
}
56 changes: 27 additions & 29 deletions src/hotspot/os/bsd/osThread_bsd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,22 @@
#ifndef OS_BSD_OSTHREAD_BSD_HPP
#define OS_BSD_OSTHREAD_BSD_HPP

private:
int _thread_type;
#include "runtime/osThreadBase.hpp"
#include "suspendResume_posix.hpp"
#include "utilities/globalDefinitions.hpp"

public:

int thread_type() const {
return _thread_type;
}
void set_thread_type(int type) {
_thread_type = type;
}

private:
class OSThread : public OSThreadBase {
friend class VMStructs;

#ifdef __APPLE__
typedef thread_t thread_id_t;
#else
typedef pid_t thread_id_t;
#endif

thread_id_t _thread_id;
int _thread_type;

// _pthread_id is the pthread id, which is used by library calls
// (e.g. pthread_kill).
pthread_t _pthread_id;
Expand All @@ -57,15 +53,26 @@
sigset_t _caller_sigmask; // Caller's signal mask

public:
OSThread();
~OSThread();

int thread_type() const {
return _thread_type;
}
void set_thread_type(int type) {
_thread_type = type;
}

// Methods to save/restore caller's signal mask
sigset_t caller_sigmask() const { return _caller_sigmask; }
void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }

#ifndef PRODUCT
// Used for debugging, return a unique integer for each thread.
intptr_t thread_identifier() const { return (intptr_t)_pthread_id; }
#endif
thread_id_t thread_id() const {
return _thread_id;
}
void set_thread_id(thread_id_t id) {
_thread_id = id;
}

pthread_t pthread_id() const {
return _pthread_id;
Expand All @@ -80,7 +87,6 @@
// suspension support.
// ***************************************************************

public:
// flags that support signal based suspend/resume on Bsd are in a
// separate class to avoid confusion with many flags in OSThread that
// are used by VM level suspend/resume.
Expand Down Expand Up @@ -126,17 +132,9 @@
return _startThread_lock;
}

// ***************************************************************
// Platform dependent initialization and cleanup
// ***************************************************************

private:

void pd_initialize();
void pd_destroy();

// Reconciliation History
// osThread_solaris.hpp 1.24 99/08/27 13:11:54
// End
uintx thread_id_for_printing() const override {
return (uintx)_thread_id;
}
};

#endif // OS_BSD_OSTHREAD_BSD_HPP
18 changes: 15 additions & 3 deletions src/hotspot/os/bsd/vmStructs_bsd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@
// constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp.

#define VM_STRUCTS_OS(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)

#define VM_TYPES_OS(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
#define VM_STRUCTS_OS(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\
/******************************/ \
/* Threads (NOTE: incomplete) */ \
/******************************/ \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \
nonstatic_field(OSThread, _unique_thread_id, uint64_t)

#define VM_TYPES_OS(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\
/**********************/ \
/* Thread IDs */ \
/**********************/ \
\
declare_unsigned_integer_type(OSThread::thread_id_t)

#define VM_INT_CONSTANTS_OS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)

Expand Down
Loading