src/hotspot/os/solaris/os_solaris.hpp
author redestad
Thu, 17 Oct 2019 00:00:13 +0200
changeset 58654 562bf1878089
parent 57738 807d192fb7dd
child 58679 9c3209ff7550
permissions -rw-r--r--
8232211: Remove dead code from os.hpp|cpp Reviewed-by: dholmes, dcubed, rehn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52302
diff changeset
     2
 * Copyright (c) 1997, 2019, 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: 2253
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2253
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: 2253
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52302
diff changeset
    25
#ifndef OS_SOLARIS_OS_SOLARIS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52302
diff changeset
    26
#define OS_SOLARIS_OS_SOLARIS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Solaris_OS defines the interface to Solaris operating systems
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    30
// see thr_setprio(3T) for the basis of these numbers
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    31
#define MinimumPriority 0
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    32
#define NormalPriority  64
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    33
#define MaximumPriority 127
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    34
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    35
// FX/60 is critical thread class/priority on T4
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    36
#define FXCriticalPriority 60
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33732
diff changeset
    37
22852
1063026e8cee 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 18702
diff changeset
    38
// Information about the protection of the page at address '0' on this os.
1063026e8cee 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 18702
diff changeset
    39
static bool zero_page_read_protected() { return true; }
1063026e8cee 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 18702
diff changeset
    40
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class Solaris {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  friend class os;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Support for "new" libthread APIs for getting & setting thread context (2.8)
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    47
#define TRS_VALID       0
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    48
#define TRS_NONVOLATILE 1
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    49
#define TRS_LWPID       2
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    50
#define TRS_INVALID     3
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // initialized to libthread or lwp synchronization primitives depending on UseLWPSychronization
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static int_fnP_mutex_tP _mutex_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  static int_fnP_mutex_tP _mutex_trylock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  static int_fnP_mutex_tP _mutex_unlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static int_fnP_mutex_tP_i_vP _mutex_init;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static int_fnP_mutex_tP _mutex_destroy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static int _mutex_scope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static int_fnP_cond_tP_mutex_tP_timestruc_tP _cond_timedwait;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static int_fnP_cond_tP_mutex_tP _cond_wait;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  static int_fnP_cond_tP _cond_signal;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static int_fnP_cond_tP _cond_broadcast;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static int_fnP_cond_tP_i_vP _cond_init;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static int_fnP_cond_tP _cond_destroy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  static int _cond_scope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
47524
97569cf468f4 8187040: ThreadCritical crashes on Solaris if used between os::init and os::init_2
mgerdin
parents: 47216
diff changeset
    68
  static bool _synchronization_initialized;
97569cf468f4 8187040: ThreadCritical crashes on Solaris if used between os::init and os::init_2
mgerdin
parents: 47216
diff changeset
    69
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  typedef uintptr_t       lgrp_cookie_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  typedef id_t            lgrp_id_t;
391
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
    72
  typedef int             lgrp_rsrc_t;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  typedef enum lgrp_view {
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    74
    LGRP_VIEW_CALLER,       // what's available to the caller
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    75
    LGRP_VIEW_OS            // what's available to operating system
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  } lgrp_view_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  typedef int (*lgrp_children_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                                      lgrp_id_t *lgrp_array, uint_t lgrp_array_size);
391
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
    84
  typedef int (*lgrp_resources_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
    85
                                       lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
    86
                                       lgrp_rsrc_t type);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1615
diff changeset
    89
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  static lgrp_home_func_t _lgrp_home;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  static lgrp_init_func_t _lgrp_init;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  static lgrp_fini_func_t _lgrp_fini;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  static lgrp_root_func_t _lgrp_root;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  static lgrp_children_func_t _lgrp_children;
391
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
    95
  static lgrp_resources_func_t _lgrp_resources;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  static lgrp_nlgrps_func_t _lgrp_nlgrps;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  static lgrp_cookie_stale_func_t _lgrp_cookie_stale;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  static lgrp_cookie_t _lgrp_cookie;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
18702
e6fa43c6d215 8016749: -XX:+UseISM fails an assert(obj->is_oop()) when running SPECjbb2005
anoll
parents: 18069
diff changeset
   100
  // Large Page Support
26697
85022e85f91d 8049536: os::commit_memory on Solaris uses aligment_hint as page size
ehelin
parents: 25472
diff changeset
   101
  static bool is_valid_page_size(size_t bytes);
85022e85f91d 8049536: os::commit_memory on Solaris uses aligment_hint as page size
ehelin
parents: 25472
diff changeset
   102
  static size_t page_size_for_alignment(size_t alignment);
18702
e6fa43c6d215 8016749: -XX:+UseISM fails an assert(obj->is_oop()) when running SPECjbb2005
anoll
parents: 18069
diff changeset
   103
  static bool setup_large_pages(caddr_t start, size_t bytes, size_t align);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  static void try_enable_extended_io();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  static struct sigaction *(*get_signal_action)(int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  static struct sigaction *get_preinstalled_handler(int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  static int (*get_libjsig_version)();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  static void save_preinstalled_handler(int, struct sigaction&);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  static void check_signal_handler(int sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
37442
942637261b21 8151322: Implement os::set_native_thread_name() on Solaris
dholmes
parents: 35077
diff changeset
   113
  typedef int (*pthread_setname_np_func_t)(pthread_t, const char*);
942637261b21 8151322: Implement os::set_native_thread_name() on Solaris
dholmes
parents: 35077
diff changeset
   114
  static pthread_setname_np_func_t _pthread_setname_np;
942637261b21 8151322: Implement os::set_native_thread_name() on Solaris
dholmes
parents: 35077
diff changeset
   115
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Large Page Support--ISM.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  static bool largepage_range(char* addr, size_t size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static bool valid_stack_address(Thread* thread, address sp);
35077
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   123
  static bool valid_ucontext(Thread* thread, const ucontext_t* valid, const ucontext_t* suspect);
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   124
  static const ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   125
                                                    const ucontext_t* uc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
35077
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   127
  static ExtendedPC  ucontext_get_ExtendedPC(const ucontext_t* uc);
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   128
  static intptr_t*   ucontext_get_sp(const ucontext_t* uc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // ucontext_get_fp() is only used by Solaris X86 (see note below)
35077
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   130
  static intptr_t*   ucontext_get_fp(const ucontext_t* uc);
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   131
  static address    ucontext_get_pc(const ucontext_t* uc);
29573
2d800e5d575f 8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents: 26704
diff changeset
   132
  static void ucontext_set_pc(ucontext_t* uc, address pc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // For Analyzer Forte AsyncGetCallTrace profiling support:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // Parameter ret_fp is only used by Solaris X86.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  // We should have different declarations of this interface in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // provides extensions to the os class and not the Solaris class.
35077
8b86440d3bf1 8145114: const-correctness for ucontext_t* reading functions
stuefe
parents: 35071
diff changeset
   140
  static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   141
                                              intptr_t** ret_sp, intptr_t** ret_fp);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
35071
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 34145
diff changeset
   143
  static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 34145
diff changeset
   144
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  static void hotspot_sigmask(Thread* thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 13963
diff changeset
   147
  // SR_handler
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 13963
diff changeset
   148
  static void SR_handler(Thread* thread, ucontext_t* uc);
52302
912b79d983d9 8212173: Thread._stack_base/_stack_size initialized too late for new threads
stuefe
parents: 50177
diff changeset
   149
912b79d983d9 8212173: Thread._stack_base/_stack_size initialized too late for new threads
stuefe
parents: 50177
diff changeset
   150
  static void init_thread_fpu_state(void);
912b79d983d9 8212173: Thread._stack_base/_stack_size initialized too late for new threads
stuefe
parents: 50177
diff changeset
   151
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Solaris-specific interface goes here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  static julong available_memory();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  static julong physical_memory() { return _physical_memory; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  static julong _physical_memory;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  static void initialize_system_info();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  static int _dev_zero_fd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  static int get_dev_zero_fd() { return _dev_zero_fd; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  static void set_dev_zero_fd(int fd) { _dev_zero_fd = fd; }
18069
e6d4971c8650 8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents: 18025
diff changeset
   161
  static int commit_memory_impl(char* addr, size_t bytes, bool exec);
e6d4971c8650 8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents: 18025
diff changeset
   162
  static int commit_memory_impl(char* addr, size_t bytes,
e6d4971c8650 8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents: 18025
diff changeset
   163
                                size_t alignment_hint, bool exec);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  static char* mmap_chunk(char *addr, size_t size, int flags, int prot);
233
9f4505c94388 6204603: Modify hotspot to use new Solaris mmap semantics for class data archive file
sbohne
parents: 1
diff changeset
   165
  static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  static bool mpss_sanity_check(bool warn, size_t * page_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  // Workaround for 4352906. thr_stksegment sometimes returns
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // a bad value for the primordial thread's stack base when
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // it is called more than one time.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  // Workaround is to cache the initial value to avoid further
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // calls to thr_stksegment.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  // It appears that someone (Hotspot?) is trashing the user's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // proc_t structure (note that this is a system struct).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  static address _main_stack_base;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
12735
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 7397
diff changeset
   177
  static void print_distro_info(outputStream* st);
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 7397
diff changeset
   178
  static void print_libversion_info(outputStream* st);
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 7397
diff changeset
   179
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  static void libthread_init();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  static void synchronization_init();
1615
b46d9f19bde2 6779436: NUMA allocator: libnuma expects certain size of the buffer in numa_node_to_cpus()
iveresov
parents: 670
diff changeset
   183
  static bool liblgrp_init();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // This boolean allows users to forward their own non-matching signals
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // to JVM_handle_solaris_signal, harmlessly.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  static bool signal_handlers_are_installed;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  static void signal_sets_init();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  static void install_signal_handlers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  static void set_signal_handler(int sig, bool set_installed, bool oktochain);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  static void init_signal_mem();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  static void set_our_sigflags(int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  static int get_our_sigflags(int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  // For signal-chaining
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
                                 // signal(), sigset() is loaded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  static struct sigaction *get_chained_signal_action(int sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  static bool chained_handler(int sig, siginfo_t *siginfo, void *context);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  // Allows us to switch between lwp and thread -based synchronization
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  static int mutex_lock(mutex_t *mx)    { return _mutex_lock(mx); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  static int mutex_trylock(mutex_t *mx) { return _mutex_trylock(mx); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  static int mutex_unlock(mutex_t *mx)  { return _mutex_unlock(mx); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  static int mutex_init(mutex_t *mx)    { return _mutex_init(mx, os::Solaris::mutex_scope(), NULL); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  static int mutex_destroy(mutex_t *mx) { return _mutex_destroy(mx); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  static int mutex_scope()              { return _mutex_scope; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  static void set_mutex_lock(int_fnP_mutex_tP func)      { _mutex_lock = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  static void set_mutex_trylock(int_fnP_mutex_tP func)   { _mutex_trylock = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  static void set_mutex_unlock(int_fnP_mutex_tP func)    { _mutex_unlock = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  static void set_mutex_init(int_fnP_mutex_tP_i_vP func) { _mutex_init = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  static void set_mutex_destroy(int_fnP_mutex_tP func)   { _mutex_destroy = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  static void set_mutex_scope(int scope)                 { _mutex_scope = scope; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   216
  static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) { return _cond_timedwait(cv, mx, abst); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  static int cond_wait(cond_t *cv, mutex_t *mx) { return _cond_wait(cv, mx); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  static int cond_signal(cond_t *cv)            { return _cond_signal(cv); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  static int cond_broadcast(cond_t *cv)         { return _cond_broadcast(cv); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  static int cond_init(cond_t *cv)              { return _cond_init(cv, os::Solaris::cond_scope(), NULL); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  static int cond_destroy(cond_t *cv)           { return _cond_destroy(cv); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  static int cond_scope()                       { return _cond_scope; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   224
  static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) { _cond_timedwait = func; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  static void set_cond_wait(int_fnP_cond_tP_mutex_tP func) { _cond_wait = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  static void set_cond_signal(int_fnP_cond_tP func)        { _cond_signal = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  static void set_cond_broadcast(int_fnP_cond_tP func)     { _cond_broadcast = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  static void set_cond_init(int_fnP_cond_tP_i_vP func)     { _cond_init = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  static void set_cond_destroy(int_fnP_cond_tP func)       { _cond_destroy = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  static void set_cond_scope(int scope)                    { _cond_scope = scope; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
47524
97569cf468f4 8187040: ThreadCritical crashes on Solaris if used between os::init and os::init_2
mgerdin
parents: 47216
diff changeset
   232
  static bool synchronization_initialized()                { return _synchronization_initialized; }
97569cf468f4 8187040: ThreadCritical crashes on Solaris if used between os::init and os::init_2
mgerdin
parents: 47216
diff changeset
   233
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  static void set_lgrp_home(lgrp_home_func_t func) { _lgrp_home = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  static void set_lgrp_init(lgrp_init_func_t func) { _lgrp_init = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  static void set_lgrp_fini(lgrp_fini_func_t func) { _lgrp_fini = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  static void set_lgrp_root(lgrp_root_func_t func) { _lgrp_root = func; }
391
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   238
  static void set_lgrp_children(lgrp_children_func_t func)   { _lgrp_children = func; }
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   239
  static void set_lgrp_resources(lgrp_resources_func_t func) { _lgrp_resources = func; }
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   240
  static void set_lgrp_nlgrps(lgrp_nlgrps_func_t func)       { _lgrp_nlgrps = func; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  static void set_lgrp_cookie_stale(lgrp_cookie_stale_func_t func) { _lgrp_cookie_stale = func; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  static void set_lgrp_cookie(lgrp_cookie_t cookie)  { _lgrp_cookie = cookie; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  static id_t lgrp_home(idtype_t type, id_t id)      { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  static lgrp_cookie_t lgrp_init(lgrp_view_t view)   { return _lgrp_init != NULL ? _lgrp_init(view) : 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  static int lgrp_fini(lgrp_cookie_t cookie)         { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; }
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   247
  static lgrp_id_t lgrp_root(lgrp_cookie_t cookie)   { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  static int lgrp_children(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   249
                           lgrp_id_t *lgrp_array, uint_t lgrp_array_size) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  }
391
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   252
  static int lgrp_resources(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   253
                            lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   254
                            lgrp_rsrc_t type) {
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   255
    return _lgrp_resources != NULL ? _lgrp_resources(cookie, lgrp, lgrp_array, lgrp_array_size, type) : -1;
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   256
  }
f889070a8684 6697534: Premature GC and invalid lgrp selection with NUMA-aware allocator.
iveresov
parents: 233
diff changeset
   257
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  static int lgrp_nlgrps(lgrp_cookie_t cookie)       { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  static int lgrp_cookie_stale(lgrp_cookie_t cookie) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    return _lgrp_cookie_stale != NULL ? _lgrp_cookie_stale(cookie) : -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  static lgrp_cookie_t lgrp_cookie()                 { return _lgrp_cookie; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  static sigset_t* unblocked_signals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  static sigset_t* vm_signals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  // %%% Following should be promoted to os.hpp:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  // Trace number of created threads
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  static          jint  _os_thread_limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  static volatile jint  _os_thread_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
52302
912b79d983d9 8212173: Thread._stack_base/_stack_size initialized too late for new threads
stuefe
parents: 50177
diff changeset
   272
  static void correct_stack_boundaries_for_primordial_thread(Thread* thr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  // Stack repair handling
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  // none present
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
53849
46ef4dea49e5 8219370: NMT: Move synchronization primitives from mtInternal to mtSynchronizer
zgu
parents: 53646
diff changeset
   280
class PlatformEvent : public CHeapObj<mtSynchronizer> {
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   281
 private:
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   282
  double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   283
  volatile int _Event;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   284
  int _nParked;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   285
  int _pipev[2];
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   286
  mutex_t _mutex[1];
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   287
  cond_t  _cond[1];
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   288
  double PostPad[2];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   290
 protected:
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   291
  // Defining a protected ctor effectively gives us an abstract base class.
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   292
  // That is, a PlatformEvent can never be instantiated "naked" but only
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   293
  // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   294
  // TODO-FIXME: make dtor private
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   295
  ~PlatformEvent() { guarantee(0, "invariant"); }
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   296
  PlatformEvent() {
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   297
    int status;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   298
    status = os::Solaris::cond_init(_cond);
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   299
    assert_status(status == 0, status, "cond_init");
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   300
    status = os::Solaris::mutex_init(_mutex);
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   301
    assert_status(status == 0, status, "mutex_init");
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   302
    _Event   = 0;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   303
    _nParked = 0;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   304
    _pipev[0] = _pipev[1] = -1;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   305
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   307
 public:
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   308
  // Exercise caution using reset() and fired() -- they may require MEMBARs
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   309
  void reset() { _Event = 0; }
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   310
  int  fired() { return _Event; }
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   311
  void park();
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   312
  int  park(jlong millis);
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   313
  void unpark();
25069
c937c5e883c5 8047156: cleanup more non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 23865
diff changeset
   314
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
53849
46ef4dea49e5 8219370: NMT: Move synchronization primitives from mtInternal to mtSynchronizer
zgu
parents: 53646
diff changeset
   316
class PlatformParker : public CHeapObj<mtSynchronizer> {
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   317
 protected:
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   318
  mutex_t _mutex[1];
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   319
  cond_t  _cond[1];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   321
 public:       // TODO-FIXME: make dtor private
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   322
  ~PlatformParker() { guarantee(0, "invariant"); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   324
 public:
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   325
  PlatformParker() {
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   326
    int status;
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   327
    status = os::Solaris::cond_init(_cond);
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   328
    assert_status(status == 0, status, "cond_init");
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   329
    status = os::Solaris::mutex_init(_mutex);
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   330
    assert_status(status == 0, status, "mutex_init");
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25472
diff changeset
   331
  }
25069
c937c5e883c5 8047156: cleanup more non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 23865
diff changeset
   332
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   333
57738
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   334
// Platform specific implementations that underpin VM Mutex/Monitor classes
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   335
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   336
class PlatformMutex : public CHeapObj<mtSynchronizer> {
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   337
  // Disable copying
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   338
  PlatformMutex(const PlatformMutex&);
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   339
  PlatformMutex& operator=(const PlatformMutex&);
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   340
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   341
 protected:
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   342
  mutex_t _mutex; // Native mutex for locking
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   343
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   344
 public:
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   345
  PlatformMutex();
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   346
  ~PlatformMutex();
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   347
  void lock();
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   348
  void unlock();
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   349
  bool try_lock();
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   350
};
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   351
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   352
class PlatformMonitor : public PlatformMutex {
53646
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   353
 private:
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   354
  cond_t  _cond;  // Native condition variable for blocking
57738
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   355
  // Disable copying
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   356
  PlatformMonitor(const PlatformMonitor&);
807d192fb7dd 8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents: 53849
diff changeset
   357
  PlatformMonitor& operator=(const PlatformMonitor&);
53646
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   358
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   359
 public:
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   360
  PlatformMonitor();
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   361
  ~PlatformMonitor();
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   362
  int wait(jlong millis);
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   363
  void notify();
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   364
  void notify_all();
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   365
};
043ae846819f 8210832: Remove sneaky locking in class Monitor
pchilanomate
parents: 53244
diff changeset
   366
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52302
diff changeset
   367
#endif // OS_SOLARIS_OS_SOLARIS_HPP