Mercurial > hg > truffle
annotate src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp @ 2069:c19157304e08
Merge
author | zgu |
---|---|
date | Wed, 22 Dec 2010 11:52:12 -0500 |
parents | f95d63e2154a |
children | c04052fd6ae1 |
rev | line source |
---|---|
0 | 1 /* |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "runtime/os.hpp" | |
27 #include "vm_version_sparc.hpp" | |
0 | 28 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
29 # include <sys/auxv.h> |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
30 # include <sys/auxv_SPARC.h> |
0 | 31 # include <sys/systeminfo.h> |
32 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
33 // We need to keep these here as long as we have to build on Solaris |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
34 // versions before 10. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
35 #ifndef SI_ARCHITECTURE_32 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
36 #define SI_ARCHITECTURE_32 516 /* basic 32-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
37 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
38 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
39 #ifndef SI_ARCHITECTURE_64 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
40 #define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
41 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
42 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
43 static void do_sysinfo(int si, const char* string, int* features, int mask) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
44 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
45 size_t bufsize = sysinfo(si, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
46 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
47 // All SI defines used below must be supported. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
48 guarantee(bufsize != -1, "must be supported"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
49 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
50 char* buf = (char*) malloc(bufsize); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
51 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
52 if (buf == NULL) |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
53 return; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
54 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
55 if (sysinfo(si, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
56 // Compare the string. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
57 if (strcmp(buf, string) == 0) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
58 *features |= mask; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
59 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
60 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
61 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
62 free(buf); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
63 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
64 |
0 | 65 int VM_Version::platform_features(int features) { |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
66 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
67 // supported on Solaris 10 and later. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
68 if (os::Solaris::supports_getisax()) { |
0 | 69 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
70 // Check 32-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
71 do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
72 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
73 // Check 64-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
74 do_sysinfo(SI_ARCHITECTURE_64, "sparcv9", &features, generic_v9_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
75 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
76 // Extract valid instruction set extensions. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
77 uint_t av; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
78 uint_t avn = os::Solaris::getisax(&av, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
79 assert(avn == 1, "should only return one av"); |
0 | 80 |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
81 #ifndef PRODUCT |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
82 if (PrintMiscellaneous && Verbose) |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
83 tty->print_cr("getisax(2) returned: " PTR32_FORMAT, av); |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
84 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
85 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
86 if (av & AV_SPARC_MUL32) features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
87 if (av & AV_SPARC_DIV32) features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
88 if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
89 if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
643
c771b7f43bbf
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
641
diff
changeset
|
90 if (av & AV_SPARC_POPC) features |= hardware_popc_m; |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
91 if (av & AV_SPARC_VIS) features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
92 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
93 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
94 // Next values are not defined before Solaris 10 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
95 // but Solaris 8 is used for jdk6 update builds. |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
96 #ifndef AV_SPARC_ASI_BLK_INIT |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
97 #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
98 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
99 #ifndef AV_SPARC_FMAF |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
100 #define AV_SPARC_FMAF 0x0100 /* Sparc64 Fused Multiply-Add */ |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
101 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
102 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
103 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
104 } else { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
105 // getisax(2) failed, use the old legacy code. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
106 #ifndef PRODUCT |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
107 if (PrintMiscellaneous && Verbose) |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
108 tty->print_cr("getisax(2) is not supported."); |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
109 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
110 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
111 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
112 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
113 char* buf = (char*) malloc(bufsize); |
0 | 114 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
115 if (buf != NULL) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
116 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
117 // Figure out what kind of sparc we have |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
118 char *sparc_string = strstr(buf, "sparc"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
119 if (sparc_string != NULL) { features |= v8_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
120 if (sparc_string[5] == 'v') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
121 if (sparc_string[6] == '8') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
122 if (sparc_string[7] == '-') { features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
123 features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
124 } else if (sparc_string[7] == 'p') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
125 else features |= generic_v8_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
126 } else if (sparc_string[6] == '9') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
127 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
128 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
129 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
130 // Check for visualization instructions |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
131 char *vis = strstr(buf, "vis"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
132 if (vis != NULL) { features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
133 if (vis[3] == '2') features |= vis2_instructions_m; |
0 | 134 } |
135 } | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
136 free(buf); |
0 | 137 } |
138 } | |
139 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
140 // Determine the machine type. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
141 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
0 | 142 |
143 return features; | |
144 } |