hotspot/src/os/solaris/vm/osThread_solaris.hpp
author alanbur
Mon, 17 Oct 2016 19:18:08 -0400
changeset 41707 7a8490836761
parent 23865 ba4aeedb2a9f
child 47106 bed18a111b90
permissions -rw-r--r--
8157141: Fix for JDK-8031290 is unnecessarily fragile 8166454: meminfo(2) has been available since Solaris 9 Reviewed-by: dholmes, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
23443
15e8ed68f73a 8036128: Remove deprecated VM flag UseVMInterruptibleIO
fparain
parents: 18025
diff changeset
     2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5904
diff changeset
    25
#ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5904
diff changeset
    26
#define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5904
diff changeset
    27
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// This is embedded via include into the class OSThread
12765
3e1b42265329 7161732: Improve handling of thread_id in OSThread
rbackman
parents: 12377
diff changeset
    29
 public:
3e1b42265329 7161732: Improve handling of thread_id in OSThread
rbackman
parents: 12377
diff changeset
    30
  typedef thread_t thread_id_t;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
 private:
11601
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    33
  uint     _lwp_id;            // lwp ID, only used with bound threads
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    34
  int      _native_priority;   // Saved native priority when starting
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    35
                               // a bound thread
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    36
  sigset_t _caller_sigmask;    // Caller's signal mask
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    37
  bool     _vm_created_thread; // true if the VM created this thread,
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    38
                               // false if primary thread or attached thread
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
 public:
11601
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    40
  uint     lwp_id() const          { return _lwp_id; }
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    41
  int      native_priority() const { return _native_priority; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  // Set and get state of _vm_created_thread flag
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  void set_vm_created()           { _vm_created_thread = true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  bool is_vm_created()            { return _vm_created_thread; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // Methods to save/restore caller's signal mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  sigset_t  caller_sigmask() const       { return _caller_sigmask; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // Used for debugging, return a unique integer for each thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  int thread_identifier() const   { return _thread_id; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // On solaris reposition can fail in two ways:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // 1: a mismatched pc, because signal is delivered too late, target thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  //    is resumed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // 2: on a timeout where signal is lost, target thread is resumed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  bool valid_reposition_failure() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    // only 1 and 2 can happen and we can handle both of them
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#endif
11601
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    65
  void set_lwp_id(uint id)           { _lwp_id = id; }
f359304c1856 7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents: 7397
diff changeset
    66
  void set_native_priority(int prio) { _native_priority = prio; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
 // ***************************************************************
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
 // interrupt support.  interrupts (using signals) are used to get
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
 // the thread context (get_thread_pc), to set the thread context
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
 // (set_thread_pc), and to implement java.lang.Thread.interrupt.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
 // ***************************************************************
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
 public:
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 12765
diff changeset
    75
  os::SuspendResume sr;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
 private:
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 12765
diff changeset
    78
  ucontext_t* _ucontext;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
 public:
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 12765
diff changeset
    81
  ucontext_t* ucontext() const { return _ucontext; }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 12765
diff changeset
    82
  void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 12765
diff changeset
    83
  static void SR_handler(Thread* thread, ucontext_t* uc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // ***************************************************************
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // Platform dependent initialization and cleanup
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // ***************************************************************
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  void pd_initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  void pd_destroy();
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5904
diff changeset
    93
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5904
diff changeset
    94
#endif // OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP