Mercurial > hg > truffle
annotate src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp @ 20590:c47fcf523fff
8042428: CompileQueue::free_all() code is incorrect
Summary: Free task after getting next pointer of freelist.
Reviewed-by: kvn, adlertz
author | anoll |
---|---|
date | Tue, 06 May 2014 09:52:38 +0200 |
parents | c49cd31b6da6 |
children | 7848fc12602b |
rev | line source |
---|---|
0 | 1 /* |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
2 * Copyright (c) 2006, 2014, 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 |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
29 #include <sys/auxv.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
30 #include <sys/auxv_SPARC.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
31 #include <sys/systeminfo.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
32 #include <kstat.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
33 #include <picl.h> |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
34 #include <dlfcn.h> |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
35 #include <link.h> |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
36 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
37 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
38 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
39 |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
40 // Functions from the library we need (signatures should match those in picl.h) |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
41 extern "C" { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
42 typedef int (*picl_initialize_func_t)(void); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
43 typedef int (*picl_shutdown_func_t)(void); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
44 typedef int (*picl_get_root_func_t)(picl_nodehdl_t *nodehandle); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
45 typedef int (*picl_walk_tree_by_class_func_t)(picl_nodehdl_t rooth, |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
46 const char *classname, void *c_args, |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
47 int (*callback_fn)(picl_nodehdl_t hdl, void *args)); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
48 typedef int (*picl_get_prop_by_name_func_t)(picl_nodehdl_t nodeh, const char *nm, |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
49 picl_prophdl_t *ph); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
50 typedef int (*picl_get_propval_func_t)(picl_prophdl_t proph, void *valbuf, size_t sz); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
51 typedef int (*picl_get_propinfo_func_t)(picl_prophdl_t proph, picl_propinfo_t *pi); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
52 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
53 |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
54 class PICL { |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
55 // Pointers to functions in the library |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
56 picl_initialize_func_t _picl_initialize; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
57 picl_shutdown_func_t _picl_shutdown; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
58 picl_get_root_func_t _picl_get_root; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
59 picl_walk_tree_by_class_func_t _picl_walk_tree_by_class; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
60 picl_get_prop_by_name_func_t _picl_get_prop_by_name; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
61 picl_get_propval_func_t _picl_get_propval; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
62 picl_get_propinfo_func_t _picl_get_propinfo; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
63 // Handle to the library that is returned by dlopen |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
64 void *_dl_handle; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
65 |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
66 bool open_library(); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
67 void close_library(); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
68 |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
69 template<typename FuncType> bool bind(FuncType& func, const char* name); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
70 bool bind_library_functions(); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
71 |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
72 // Get a value of the integer property. The value in the tree can be either 32 or 64 bit |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
73 // depending on the platform. The result is converted to int. |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
74 int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
75 picl_propinfo_t pinfo; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
76 picl_prophdl_t proph; |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
77 if (_picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
78 _picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
79 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
80 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
81 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
82 if (pinfo.type != PICL_PTYPE_INT && pinfo.type != PICL_PTYPE_UNSIGNED_INT) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
83 assert(false, "Invalid property type"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
84 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
85 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
86 if (pinfo.size == sizeof(int64_t)) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
87 int64_t val; |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
88 if (_picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
89 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
90 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
91 *result = static_cast<int>(val); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
92 } else if (pinfo.size == sizeof(int32_t)) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
93 int32_t val; |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
94 if (_picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
95 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
96 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
97 *result = static_cast<int>(val); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
98 } else { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
99 assert(false, "Unexpected integer property size"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
100 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
101 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
102 return PICL_SUCCESS; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
103 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
104 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
105 // Visitor and a state machine that visits integer properties and verifies that the |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
106 // values are the same. Stores the unique value observed. |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
107 class UniqueValueVisitor { |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
108 PICL *_picl; |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
109 enum { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
110 INITIAL, // Start state, no assignments happened |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
111 ASSIGNED, // Assigned a value |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
112 INCONSISTENT // Inconsistent value seen |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
113 } _state; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
114 int _value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
115 public: |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
116 UniqueValueVisitor(PICL* picl) : _picl(picl), _state(INITIAL) { } |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
117 int value() { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
118 assert(_state == ASSIGNED, "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
119 return _value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
120 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
121 void set_value(int value) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
122 assert(_state == INITIAL, "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
123 _value = value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
124 _state = ASSIGNED; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
125 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
126 bool is_initial() { return _state == INITIAL; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
127 bool is_assigned() { return _state == ASSIGNED; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
128 bool is_inconsistent() { return _state == INCONSISTENT; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
129 void set_inconsistent() { _state = INCONSISTENT; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
130 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
131 static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
132 UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg); |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
133 PICL* picl = state->_picl; |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
134 assert(!state->is_inconsistent(), "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
135 int curr; |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
136 if (picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
137 if (!state->is_assigned()) { // first iteration |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
138 state->set_value(curr); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
139 } else if (curr != state->value()) { // following iterations |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
140 state->set_inconsistent(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
141 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
142 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
143 if (state->is_inconsistent()) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
144 return PICL_WALK_TERMINATE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
145 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
146 return PICL_WALK_CONTINUE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
147 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
148 }; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
149 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
150 int _L1_data_cache_line_size; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
151 int _L2_cache_line_size; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
152 public: |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
153 static int get_l1_data_cache_line_size(picl_nodehdl_t nodeh, void *state) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
154 return UniqueValueVisitor::visit(nodeh, "l1-dcache-line-size", state); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
155 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
156 static int get_l2_cache_line_size(picl_nodehdl_t nodeh, void *state) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
157 return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
158 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
159 |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
160 PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0), _dl_handle(NULL) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
161 if (!open_library()) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
162 return; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
163 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
164 if (_picl_initialize() == PICL_SUCCESS) { |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
165 picl_nodehdl_t rooth; |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
166 if (_picl_get_root(&rooth) == PICL_SUCCESS) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
167 UniqueValueVisitor L1_state(this); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
168 // Visit all "cpu" class instances |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
169 _picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
170 if (L1_state.is_initial()) { // Still initial, iteration found no values |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
171 // Try walk all "core" class instances, it might be a Fujitsu machine |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
172 _picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
173 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
174 if (L1_state.is_assigned()) { // Is there a value? |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
175 _L1_data_cache_line_size = L1_state.value(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
176 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
177 |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
178 UniqueValueVisitor L2_state(this); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
179 _picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
180 if (L2_state.is_initial()) { |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
181 _picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
182 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
183 if (L2_state.is_assigned()) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
184 _L2_cache_line_size = L2_state.value(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
185 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
186 } |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
187 _picl_shutdown(); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
188 } |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
189 close_library(); |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
190 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
191 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
192 unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
193 unsigned int L2_cache_line_size() const { return _L2_cache_line_size; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
194 }; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
195 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
196 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
197 return PICL::get_l1_data_cache_line_size(nodeh, result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
198 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
199 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
200 return PICL::get_l2_cache_line_size(nodeh, result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
201 } |
0 | 202 |
20582
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
203 template<typename FuncType> |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
204 bool PICL::bind(FuncType& func, const char* name) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
205 func = reinterpret_cast<FuncType>(dlsym(_dl_handle, name)); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
206 return func != NULL; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
207 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
208 |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
209 bool PICL::bind_library_functions() { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
210 assert(_dl_handle != NULL, "library should be open"); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
211 return bind(_picl_initialize, "picl_initialize" ) && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
212 bind(_picl_shutdown, "picl_shutdown" ) && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
213 bind(_picl_get_root, "picl_get_root" ) && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
214 bind(_picl_walk_tree_by_class, "picl_walk_tree_by_class") && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
215 bind(_picl_get_prop_by_name, "picl_get_prop_by_name" ) && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
216 bind(_picl_get_propval, "picl_get_propval" ) && |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
217 bind(_picl_get_propinfo, "picl_get_propinfo" ); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
218 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
219 |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
220 bool PICL::open_library() { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
221 _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
222 if (_dl_handle == NULL) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
223 warning("PICL (libpicl.so.1) is missing. Performance will not be optimal."); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
224 return false; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
225 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
226 if (!bind_library_functions()) { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
227 assert(false, "unexpected PICL API change"); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
228 close_library(); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
229 return false; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
230 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
231 return true; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
232 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
233 |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
234 void PICL::close_library() { |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
235 assert(_dl_handle != NULL, "library should be open"); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
236 dlclose(_dl_handle); |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
237 _dl_handle = NULL; |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
238 } |
c49cd31b6da6
8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents:
20421
diff
changeset
|
239 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
240 // 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
|
241 // versions before 10. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
242 #ifndef SI_ARCHITECTURE_32 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
243 #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
|
244 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
245 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
246 #ifndef SI_ARCHITECTURE_64 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
247 #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
|
248 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
249 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
250 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
|
251 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
252 size_t bufsize = sysinfo(si, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
253 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
254 // All SI defines used below must be supported. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
255 guarantee(bufsize != -1, "must be supported"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
256 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
257 char* buf = (char*) malloc(bufsize); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
258 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
259 if (buf == NULL) |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
260 return; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
261 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
262 if (sysinfo(si, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
263 // Compare the string. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
264 if (strcmp(buf, string) == 0) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
265 *features |= mask; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
266 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
267 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
268 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
269 free(buf); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
270 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
271 |
0 | 272 int VM_Version::platform_features(int features) { |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
273 // 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
|
274 // supported on Solaris 10 and later. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
275 if (os::Solaris::supports_getisax()) { |
0 | 276 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
277 // Check 32-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
278 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
|
279 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
280 // Check 64-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
281 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
|
282 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
283 // Extract valid instruction set extensions. |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
284 uint_t avs[2]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
285 uint_t avn = os::Solaris::getisax(avs, 2); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
286 assert(avn <= 2, "should return two or less av's"); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
287 uint_t av = avs[0]; |
0 | 288 |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
289 #ifndef PRODUCT |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
290 if (PrintMiscellaneous && Verbose) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
291 tty->print("getisax(2) returned: " PTR32_FORMAT, av); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
292 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
293 tty->print(", " PTR32_FORMAT, avs[1]); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
294 } |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
295 tty->cr(); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
296 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
297 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
298 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 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
|
303 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
|
304 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
|
305 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
306 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
307 uint_t av2 = avs[1]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
308 #ifndef AV2_SPARC_SPARC5 |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
309 #define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */ |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
310 #endif |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
311 if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
312 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
313 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
314 // 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
|
315 // 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
|
316 #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
|
317 #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
|
318 #endif |
2080 | 319 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
320 | |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
321 #ifndef AV_SPARC_FMAF |
2080 | 322 #define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */ |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
323 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
324 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
2080 | 325 |
326 #ifndef AV_SPARC_FMAU | |
327 #define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */ | |
328 #endif | |
329 if (av & AV_SPARC_FMAU) features |= fmau_instructions_m; | |
330 | |
331 #ifndef AV_SPARC_VIS3 | |
332 #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */ | |
333 #endif | |
334 if (av & AV_SPARC_VIS3) features |= vis3_instructions_m; | |
335 | |
3839 | 336 #ifndef AV_SPARC_CBCOND |
337 #define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */ | |
338 #endif | |
339 if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m; | |
340 | |
17670 | 341 #ifndef AV_SPARC_AES |
342 #define AV_SPARC_AES 0x00020000 /* aes instrs supported */ | |
343 #endif | |
344 if (av & AV_SPARC_AES) features |= aes_instructions_m; | |
345 | |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
346 #ifndef AV_SPARC_SHA1 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
347 #define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
348 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
349 if (av & AV_SPARC_SHA1) features |= sha1_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
350 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
351 #ifndef AV_SPARC_SHA256 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
352 #define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
353 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
354 if (av & AV_SPARC_SHA256) features |= sha256_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
355 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
356 #ifndef AV_SPARC_SHA512 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
357 #define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
358 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
359 if (av & AV_SPARC_SHA512) features |= sha512_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
360 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
361 } else { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
362 // getisax(2) failed, use the old legacy code. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
363 #ifndef PRODUCT |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
364 if (PrintMiscellaneous && Verbose) |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
365 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
|
366 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
367 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
368 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
369 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
370 char* buf = (char*) malloc(bufsize); |
0 | 371 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
372 if (buf != NULL) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
373 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
374 // Figure out what kind of sparc we have |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
375 char *sparc_string = strstr(buf, "sparc"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
376 if (sparc_string != NULL) { features |= v8_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
377 if (sparc_string[5] == 'v') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
378 if (sparc_string[6] == '8') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
379 if (sparc_string[7] == '-') { features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
380 features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
381 } 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
|
382 else features |= generic_v8_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
383 } 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
|
384 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
385 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
386 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
387 // Check for visualization instructions |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
388 char *vis = strstr(buf, "vis"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
389 if (vis != NULL) { features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
390 if (vis[3] == '2') features |= vis2_instructions_m; |
0 | 391 } |
392 } | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
393 free(buf); |
0 | 394 } |
395 } | |
396 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
397 // Determine the machine type. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
398 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
0 | 399 |
2080 | 400 { |
401 // Using kstat to determine the machine type. | |
402 kstat_ctl_t* kc = kstat_open(); | |
403 kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL); | |
404 const char* implementation = "UNKNOWN"; | |
405 if (ksp != NULL) { | |
406 if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) { | |
407 kstat_named_t* knm = (kstat_named_t *)ksp->ks_data; | |
408 for (int i = 0; i < ksp->ks_ndata; i++) { | |
409 if (strcmp((const char*)&(knm[i].name),"implementation") == 0) { | |
410 #ifndef KSTAT_DATA_STRING | |
411 #define KSTAT_DATA_STRING 9 | |
412 #endif | |
413 if (knm[i].data_type == KSTAT_DATA_CHAR) { | |
414 // VM is running on Solaris 8 which does not have value.str. | |
415 implementation = &(knm[i].value.c[0]); | |
416 } else if (knm[i].data_type == KSTAT_DATA_STRING) { | |
417 // VM is running on Solaris 10. | |
418 #ifndef KSTAT_NAMED_STR_PTR | |
419 // Solaris 8 was used to build VM, define the structure it misses. | |
420 struct str_t { | |
421 union { | |
422 char *ptr; /* NULL-term string */ | |
423 char __pad[8]; /* 64-bit padding */ | |
424 } addr; | |
425 uint32_t len; /* # bytes for strlen + '\0' */ | |
426 }; | |
427 #define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr) | |
428 #endif | |
429 implementation = KSTAT_NAMED_STR_PTR(&knm[i]); | |
430 } | |
431 #ifndef PRODUCT | |
432 if (PrintMiscellaneous && Verbose) { | |
433 tty->print_cr("cpu_info.implementation: %s", implementation); | |
434 } | |
435 #endif | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
436 // Convert to UPPER case before compare. |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
437 char* impl = strdup(implementation); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
438 |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
439 for (int i = 0; impl[i] != 0; i++) |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
440 impl[i] = (char)toupper((uint)impl[i]); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
441 if (strstr(impl, "SPARC64") != NULL) { |
2080 | 442 features |= sparc64_family_m; |
6269 | 443 } else if (strstr(impl, "SPARC-M") != NULL) { |
444 // M-series SPARC is based on T-series. | |
445 features |= (M_family_m | T_family_m); | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
446 } else if (strstr(impl, "SPARC-T") != NULL) { |
2080 | 447 features |= T_family_m; |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
448 if (strstr(impl, "SPARC-T1") != NULL) { |
2080 | 449 features |= T1_model_m; |
450 } | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
451 } else { |
6269 | 452 if (strstr(impl, "SPARC") == NULL) { |
453 #ifndef PRODUCT | |
454 // kstat on Solaris 8 virtual machines (branded zones) | |
455 // returns "(unsupported)" implementation. | |
456 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); | |
457 #endif | |
458 implementation = "SPARC"; | |
459 } | |
2080 | 460 } |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
461 free((void*)impl); |
2080 | 462 break; |
463 } | |
464 } // for( | |
465 } | |
466 } | |
467 assert(strcmp(implementation, "UNKNOWN") != 0, | |
468 "unknown cpu info (changed kstat interface?)"); | |
469 kstat_close(kc); | |
470 } | |
471 | |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
472 // Figure out cache line sizes using PICL |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
473 PICL picl; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
474 _L2_cache_line_size = picl.L2_cache_line_size(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
475 |
0 | 476 return features; |
477 } |