Mercurial > hg > graal-compiler
annotate src/os/aix/vm/os_aix.hpp @ 21810:0366a71eda74
8047125: (ref) More phantom object references
Reviewed-by: mchung, dfuchs, ahgross, jmasa, brutisso, mgerdin
Contributed-by: kim.barrett@oracle.com
author | jmasa |
---|---|
date | Fri, 26 Sep 2014 17:48:10 -0400 |
parents | 666e6ce3976c |
children | c5e86c5cd22e |
rev | line source |
---|---|
14415
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
1 /* |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
3 * Copyright 2013 SAP AG. All rights reserved. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
5 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
6 * This code is free software; you can redistribute it and/or modify it |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
7 * under the terms of the GNU General Public License version 2 only, as |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
8 * published by the Free Software Foundation. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
9 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
14 * accompanied this code). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
15 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License version |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
19 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
22 * questions. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
23 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
24 */ |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
25 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
26 #ifndef OS_AIX_VM_OS_AIX_HPP |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
27 #define OS_AIX_VM_OS_AIX_HPP |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
28 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
29 // Information about the protection of the page at address '0' on this os. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
30 static bool zero_page_read_protected() { return false; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
31 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
32 // Class Aix defines the interface to the Aix operating systems. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
33 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
34 class Aix { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
35 friend class os; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
36 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
37 // For signal-chaining |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
38 // highest so far (AIX 5.2) is SIGSAK (63) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
39 #define MAXSIGNUM 63 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
40 // length of strings included in the libperfstat structures |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
41 #define IDENTIFIER_LENGTH 64 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
42 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
43 static struct sigaction sigact[MAXSIGNUM]; // saved preinstalled sigactions |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
44 static unsigned int sigs; // mask of signals that have |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
45 // preinstalled signal handlers |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
46 static bool libjsig_is_loaded; // libjsig that interposes sigaction(), |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
47 // __sigaction(), signal() is loaded |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
48 static struct sigaction *(*get_signal_action)(int); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
49 static struct sigaction *get_preinstalled_handler(int); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
50 static void save_preinstalled_handler(int, struct sigaction&); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
51 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
52 static void check_signal_handler(int sig); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
53 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
54 // For signal flags diagnostics |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
55 static int sigflags[MAXSIGNUM]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
56 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
57 protected: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
58 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
59 static julong _physical_memory; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
60 static pthread_t _main_thread; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
61 static Mutex* _createThread_lock; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
62 static int _page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
63 static int _logical_cpus; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
64 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
65 // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
66 static int _on_pase; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
67 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
68 // -1 = uninitialized, otherwise 16 bit number: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
69 // lower 8 bit - minor version |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
70 // higher 8 bit - major version |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
71 // For AIX, e.g. 0x0601 for AIX 6.1 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
72 // for OS/400 e.g. 0x0504 for OS/400 V5R4 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
73 static int _os_version; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
74 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
75 // -1 = uninitialized, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
76 // 0 - SPEC1170 not requested (XPG_SUS_ENV is OFF or not set) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
77 // 1 - SPEC1170 requested (XPG_SUS_ENV is ON) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
78 static int _xpg_sus_mode; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
79 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
80 // -1 = uninitialized, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
81 // 0 - EXTSHM=OFF or not set |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
82 // 1 - EXTSHM=ON |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
83 static int _extshm; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
84 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
85 // page sizes on AIX. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
86 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
87 // AIX supports four different page sizes - 4K, 64K, 16MB, 16GB. The latter two |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
88 // (16M "large" resp. 16G "huge" pages) require special setup and are normally |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
89 // not available. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
90 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
91 // AIX supports multiple page sizes per process, for: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
92 // - Stack (of the primordial thread, so not relevant for us) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
93 // - Data - data, bss, heap, for us also pthread stacks |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
94 // - Text - text code |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
95 // - shared memory |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
96 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
97 // Default page sizes can be set via linker options (-bdatapsize, -bstacksize, ...) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
98 // and via environment variable LDR_CNTRL (DATAPSIZE, STACKPSIZE, ...) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
99 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
100 // For shared memory, page size can be set dynamically via shmctl(). Different shared memory |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
101 // regions can have different page sizes. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
102 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
103 // More information can be found at AIBM info center: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
104 // http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/multiple_page_size_app_support.htm |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
105 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
106 // ----- |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
107 // We want to support 4K and 64K and, if the machine is set up correctly, 16MB pages. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
108 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
109 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
110 // page size of the stack of newly created pthreads |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
111 // (should be LDR_CNTRL DATAPSIZE because stack is allocated on heap by pthread lib) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
112 static int _stack_page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
113 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
114 // Default shm page size. Read: what page size shared memory will be backed |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
115 // with if no page size was set explicitly using shmctl(SHM_PAGESIZE). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
116 // Should be LDR_CNTRL SHMPSIZE. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
117 static size_t _shm_default_page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
118 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
119 // True if sys V shm can be used with 64K pages dynamically. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
120 // (via shmctl(.. SHM_PAGESIZE..). Should be true for AIX 53 and |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
121 // newer / PASE V6R1 and newer. (0 or 1, -1 if not initialized) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
122 static int _can_use_64K_pages; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
123 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
124 // True if sys V shm can be used with 16M pages dynamically. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
125 // (via shmctl(.. SHM_PAGESIZE..). Only true on AIX 5.3 and |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
126 // newer, if the system was set up to use 16M pages and the |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
127 // jvm has enough user rights. (0 or 1, -1 if not initialized) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
128 static int _can_use_16M_pages; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
129 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
130 static julong available_memory(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
131 static julong physical_memory() { return _physical_memory; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
132 static void initialize_system_info(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
133 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
134 // OS recognitions (PASE/AIX, OS level) call this before calling any |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
135 // one of Aix::on_pase(), Aix::os_version(). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
136 static void initialize_os_info(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
137 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
138 static int commit_memory_impl(char* addr, size_t bytes, bool exec); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
139 static int commit_memory_impl(char* addr, size_t bytes, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
140 size_t alignment_hint, bool exec); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
141 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
142 // Scan environment for important settings which might effect the |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
143 // VM. Trace out settings. Warn about invalid settings and/or |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
144 // correct them. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
145 // |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
146 // Must run after os::Aix::initialue_os_info(). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
147 static void scan_environment(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
148 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
149 // Retrieve information about multipage size support. Will initialize |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
150 // _page_size, _stack_page_size, _can_use_64K_pages/_can_use_16M_pages |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
151 static void query_multipage_support(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
152 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
153 // Initialize libo4 (on PASE) and libperfstat (on AIX). Call this |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
154 // before relying on functions from either lib, e.g. Aix::get_meminfo(). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
155 static void initialize_libo4(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
156 static void initialize_libperfstat(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
157 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
158 static bool supports_variable_stack_size(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
159 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
160 public: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
161 static void init_thread_fpu_state(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
162 static pthread_t main_thread(void) { return _main_thread; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
163 // returns kernel thread id (similar to LWP id on Solaris), which can be |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
164 // used to access /proc |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
165 static pid_t gettid(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
166 static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
167 static Mutex* createThread_lock(void) { return _createThread_lock; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
168 static void hotspot_sigmask(Thread* thread); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
169 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
170 // Given an address, returns the size of the page backing that address |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
171 static size_t query_pagesize(void* p); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
172 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
173 // Return `true' if the calling thread is the primordial thread. The |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
174 // primordial thread is the thread which contains the main function, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
175 // *not* necessarily the thread which initialized the VM by calling |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
176 // JNI_CreateJavaVM. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
177 static bool is_primordial_thread(void); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
178 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
179 static int page_size(void) { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
180 assert(_page_size != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
181 return _page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
182 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
183 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
184 // Accessor methods for stack page size which may be different from usual page size. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
185 static int stack_page_size(void) { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
186 assert(_stack_page_size != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
187 return _stack_page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
188 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
189 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
190 // default shm page size. Read: what page size shared memory |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
191 // will be backed with if no page size was set explicitly using shmctl(SHM_PAGESIZE). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
192 // Should be LDR_CNTRL SHMPSIZE. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
193 static int shm_default_page_size(void) { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
194 assert(_shm_default_page_size != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
195 return _shm_default_page_size; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
196 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
197 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
198 // Return true if sys V shm can be used with 64K pages dynamically |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
199 // (via shmctl(.. SHM_PAGESIZE..). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
200 static bool can_use_64K_pages () { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
201 assert(_can_use_64K_pages != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
202 return _can_use_64K_pages == 1 ? true : false; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
203 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
204 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
205 // Return true if sys V shm can be used with 16M pages dynamically. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
206 // (via shmctl(.. SHM_PAGESIZE..). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
207 static bool can_use_16M_pages () { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
208 assert(_can_use_16M_pages != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
209 return _can_use_16M_pages == 1 ? true : false; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
210 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
211 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
212 static address ucontext_get_pc(ucontext_t* uc); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
213 static intptr_t* ucontext_get_sp(ucontext_t* uc); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
214 static intptr_t* ucontext_get_fp(ucontext_t* uc); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
215 // Set PC into context. Needed for continuation after signal. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
216 static void ucontext_set_pc(ucontext_t* uc, address pc); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
217 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
218 // This boolean allows users to forward their own non-matching signals |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
219 // to JVM_handle_aix_signal, harmlessly. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
220 static bool signal_handlers_are_installed; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
221 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
222 static int get_our_sigflags(int); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
223 static void set_our_sigflags(int, int); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
224 static void signal_sets_init(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
225 static void install_signal_handlers(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
226 static void set_signal_handler(int, bool); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
227 static bool is_sig_ignored(int sig); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
228 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
229 static sigset_t* unblocked_signals(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
230 static sigset_t* vm_signals(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
231 static sigset_t* allowdebug_blocked_signals(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
232 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
233 // For signal-chaining |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
234 static struct sigaction *get_chained_signal_action(int sig); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
235 static bool chained_handler(int sig, siginfo_t* siginfo, void* context); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
236 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
237 // libpthread version string |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
238 static void libpthread_init(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
239 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
240 // Minimum stack size a thread can be created with (allowing |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
241 // the VM to completely create the thread and enter user code) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
242 static size_t min_stack_allowed; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
243 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
244 // Return default stack size or guard size for the specified thread type |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
245 static size_t default_stack_size(os::ThreadType thr_type); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
246 static size_t default_guard_size(os::ThreadType thr_type); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
247 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
248 // Function returns true if we run on OS/400 (pase), false if we run |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
249 // on AIX. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
250 static bool on_pase() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
251 assert(_on_pase != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
252 return _on_pase ? true : false; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
253 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
254 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
255 // Function returns true if we run on AIX, false if we run on OS/400 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
256 // (pase). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
257 static bool on_aix() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
258 assert(_on_pase != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
259 return _on_pase ? false : true; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
260 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
261 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
262 // -1 = uninitialized, otherwise 16 bit number: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
263 // lower 8 bit - minor version |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
264 // higher 8 bit - major version |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
265 // For AIX, e.g. 0x0601 for AIX 6.1 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
266 // for OS/400 e.g. 0x0504 for OS/400 V5R4 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
267 static int os_version () { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
268 assert(_os_version != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
269 return _os_version; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
270 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
271 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
272 // Convenience method: returns true if running on AIX 5.3 or older. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
273 static bool on_aix_53_or_older() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
274 return on_aix() && os_version() <= 0x0503; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
275 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
276 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
277 // Returns true if we run in SPEC1170 compliant mode (XPG_SUS_ENV=ON). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
278 static bool xpg_sus_mode() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
279 assert(_xpg_sus_mode != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
280 return _xpg_sus_mode; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
281 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
282 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
283 // Returns true if EXTSHM=ON. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
284 static bool extshm() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
285 assert(_extshm != -1, "not initialized"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
286 return _extshm; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
287 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
288 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
289 // result struct for get_meminfo() |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
290 struct meminfo_t { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
291 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
292 // Amount of virtual memory (in units of 4 KB pages) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
293 unsigned long long virt_total; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
294 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
295 // Amount of real memory, in bytes |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
296 unsigned long long real_total; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
297 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
298 // Amount of free real memory, in bytes |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
299 unsigned long long real_free; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
300 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
301 // Total amount of paging space, in bytes |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
302 unsigned long long pgsp_total; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
303 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
304 // Amount of free paging space, in bytes |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
305 unsigned long long pgsp_free; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
306 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
307 }; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
308 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
309 // Result struct for get_cpuinfo(). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
310 struct cpuinfo_t { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
311 char description[IDENTIFIER_LENGTH]; // processor description (type/official name) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
312 u_longlong_t processorHZ; // processor speed in Hz |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
313 int ncpus; // number of active logical processors |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
314 double loadavg[3]; // (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
315 // To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
316 char version[20]; // processor version from _system_configuration (sys/systemcfg.h) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
317 }; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
318 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
319 // Functions to retrieve memory information on AIX, PASE. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
320 // (on AIX, using libperfstat, on PASE with libo4.so). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
321 // Returns true if ok, false if error. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
322 static bool get_meminfo(meminfo_t* pmi); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
323 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
324 // Function to retrieve cpu information on AIX |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
325 // (on AIX, using libperfstat) |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
326 // Returns true if ok, false if error. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
327 static bool get_cpuinfo(cpuinfo_t* pci); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
328 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
329 }; // os::Aix class |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
330 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
331 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
332 class PlatformEvent : public CHeapObj<mtInternal> { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
333 private: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
334 double CachePad [4]; // increase odds that _mutex is sole occupant of cache line |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
335 volatile int _Event; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
336 volatile int _nParked; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
337 pthread_mutex_t _mutex [1]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
338 pthread_cond_t _cond [1]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
339 double PostPad [2]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
340 Thread * _Assoc; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
341 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
342 public: // TODO-FIXME: make dtor private |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
343 ~PlatformEvent() { guarantee (0, "invariant"); } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
344 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
345 public: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
346 PlatformEvent() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
347 int status; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
348 status = pthread_cond_init (_cond, NULL); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
349 assert_status(status == 0, status, "cond_init"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
350 status = pthread_mutex_init (_mutex, NULL); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
351 assert_status(status == 0, status, "mutex_init"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
352 _Event = 0; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
353 _nParked = 0; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
354 _Assoc = NULL; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
355 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
356 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
357 // Use caution with reset() and fired() -- they may require MEMBARs |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
358 void reset() { _Event = 0; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
359 int fired() { return _Event; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
360 void park (); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
361 void unpark (); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
362 int TryPark (); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
363 int park (jlong millis); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
364 void SetAssociation (Thread * a) { _Assoc = a; } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
365 }; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
366 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
367 class PlatformParker : public CHeapObj<mtInternal> { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
368 protected: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
369 pthread_mutex_t _mutex [1]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
370 pthread_cond_t _cond [1]; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
371 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
372 public: // TODO-FIXME: make dtor private |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
373 ~PlatformParker() { guarantee (0, "invariant"); } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
374 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
375 public: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
376 PlatformParker() { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
377 int status; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
378 status = pthread_cond_init (_cond, NULL); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
379 assert_status(status == 0, status, "cond_init"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
380 status = pthread_mutex_init (_mutex, NULL); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
381 assert_status(status == 0, status, "mutex_init"); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
382 } |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
383 }; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
384 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
385 #endif // OS_AIX_VM_OS_AIX_HPP |