annotate src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp @ 24225:a2dbb6fcc923

Added tag jvmci-0.33 for changeset 3aed4cb813f4
author Doug Simon <doug.simon@oracle.com>
date Fri, 18 Aug 2017 22:47:33 +0200
parents f13e777eb255
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
20313
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
2 * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
26 #include "runtime/os.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
27 #include "vm_version_sparc.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
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
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
37 extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result);
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
38
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
39 // 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
40 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
41 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
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49 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
50 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
51 }
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
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
53 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
54 // 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 // 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
63 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
64
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 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
66 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
67
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 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
69 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
70
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
71 // 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
72 // 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
73 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
74 picl_propinfo_t pinfo;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
75 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
76 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
77 _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
78 return PICL_FAILURE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
79 }
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 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
82 assert(false, "Invalid property type");
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
83 return PICL_FAILURE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
84 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
85 if (pinfo.size == sizeof(int64_t)) {
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
86 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
87 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
88 return PICL_FAILURE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
89 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
90 *result = static_cast<int>(val);
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
91 } 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
92 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
93 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
94 return PICL_FAILURE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
95 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
96 *result = static_cast<int>(val);
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
97 } else {
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
98 assert(false, "Unexpected integer property size");
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
99 return PICL_FAILURE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
100 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
101 return PICL_SUCCESS;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
102 }
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 // 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
105 // 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
106 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
107 PICL *_picl;
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
108 enum {
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
109 INITIAL, // Start state, no assignments happened
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
110 ASSIGNED, // Assigned a value
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
111 INCONSISTENT // Inconsistent value seen
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
112 } _state;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
113 int _value;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
114 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
115 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
116 int value() {
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
117 assert(_state == ASSIGNED, "Precondition");
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
118 return _value;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
119 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
120 void set_value(int value) {
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
121 assert(_state == INITIAL, "Precondition");
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
122 _value = value;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
123 _state = ASSIGNED;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
124 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
125 bool is_initial() { return _state == INITIAL; }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
126 bool is_assigned() { return _state == ASSIGNED; }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
127 bool is_inconsistent() { return _state == INCONSISTENT; }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
128 void set_inconsistent() { _state = INCONSISTENT; }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
129
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
130 bool visit(picl_nodehdl_t nodeh, const char* name) {
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
131 assert(!is_inconsistent(), "Precondition");
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
132 int curr;
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
133 if (_picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
134 if (!is_assigned()) { // first iteration
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
135 set_value(curr);
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
136 } else if (curr != value()) { // following iterations
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
137 set_inconsistent();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
138 }
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
139 return true;
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
140 }
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
141 return false;
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
142 }
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
143 };
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
144
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
145 class CPUVisitor {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
146 UniqueValueVisitor _l1_visitor;
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
147 UniqueValueVisitor _l2_visitor;
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
148 int _limit; // number of times visit() can be run
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
149 public:
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
150 CPUVisitor(PICL *picl, int limit) : _l1_visitor(picl), _l2_visitor(picl), _limit(limit) {}
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
151 static int visit(picl_nodehdl_t nodeh, void *arg) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
152 CPUVisitor *cpu_visitor = static_cast<CPUVisitor*>(arg);
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
153 UniqueValueVisitor* l1_visitor = cpu_visitor->l1_visitor();
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
154 UniqueValueVisitor* l2_visitor = cpu_visitor->l2_visitor();
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
155 if (!l1_visitor->is_inconsistent()) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
156 l1_visitor->visit(nodeh, "l1-dcache-line-size");
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
157 }
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
158 static const char* l2_data_cache_line_property_name = NULL;
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
159 // On the first visit determine the name of the l2 cache line size property and memoize it.
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
160 if (l2_data_cache_line_property_name == NULL) {
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
161 assert(!l2_visitor->is_inconsistent(), "First iteration cannot be inconsistent");
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
162 l2_data_cache_line_property_name = "l2-cache-line-size";
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
163 if (!l2_visitor->visit(nodeh, l2_data_cache_line_property_name)) {
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
164 l2_data_cache_line_property_name = "l2-dcache-line-size";
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
165 l2_visitor->visit(nodeh, l2_data_cache_line_property_name);
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
166 }
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
167 } else {
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
168 if (!l2_visitor->is_inconsistent()) {
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
169 l2_visitor->visit(nodeh, l2_data_cache_line_property_name);
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
170 }
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
171 }
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
172
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
173 if (l1_visitor->is_inconsistent() && l2_visitor->is_inconsistent()) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
174 return PICL_WALK_TERMINATE;
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
175 }
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
176 cpu_visitor->_limit--;
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
177 if (cpu_visitor->_limit <= 0) {
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
178 return PICL_WALK_TERMINATE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
179 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
180 return PICL_WALK_CONTINUE;
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
181 }
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
182 UniqueValueVisitor* l1_visitor() { return &_l1_visitor; }
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
183 UniqueValueVisitor* l2_visitor() { return &_l2_visitor; }
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
184 };
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
185 int _L1_data_cache_line_size;
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
186 int _L2_data_cache_line_size;
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
187 public:
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
188 static int visit_cpu(picl_nodehdl_t nodeh, void *state) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
189 return CPUVisitor::visit(nodeh, state);
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
23165
a0622494f6b2 8080012: JVM times out with vdbench on SPARC M7-16
poonam
parents: 22963
diff changeset
192 PICL(bool is_fujitsu, bool is_sun4v) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
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
193 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
194 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
195 }
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
196 if (_picl_initialize() == PICL_SUCCESS) {
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
197 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
198 if (_picl_get_root(&rooth) == PICL_SUCCESS) {
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
199 const char* cpu_class = "cpu";
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
200 // If it's a Fujitsu machine, it's a "core"
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
201 if (is_fujitsu) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
202 cpu_class = "core";
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
203 }
23165
a0622494f6b2 8080012: JVM times out with vdbench on SPARC M7-16
poonam
parents: 22963
diff changeset
204 CPUVisitor cpu_visitor(this, (is_sun4v && !is_fujitsu) ? 1 : os::processor_count());
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
205 _picl_walk_tree_by_class(rooth, cpu_class, &cpu_visitor, PICL_visit_cpu_helper);
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
206 if (cpu_visitor.l1_visitor()->is_assigned()) { // Is there a value?
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
207 _L1_data_cache_line_size = cpu_visitor.l1_visitor()->value();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
208 }
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
209 if (cpu_visitor.l2_visitor()->is_assigned()) {
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
210 _L2_data_cache_line_size = cpu_visitor.l2_visitor()->value();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
211 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
212 }
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
213 _picl_shutdown();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
214 }
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
215 close_library();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
216 }
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
217
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
218 unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; }
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
219 unsigned int L2_data_cache_line_size() const { return _L2_data_cache_line_size; }
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
220 };
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
221
22962
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
222
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
223 extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result) {
2ac41ee91b06 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 20582
diff changeset
224 return PICL::visit_cpu(nodeh, result);
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
225 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
226
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
227 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
228 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
229 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
230 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
231 }
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 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
234 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
235 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
236 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
237 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
238 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
239 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
240 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
241 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
242 }
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
243
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
244 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
245 _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
246 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
247 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
248 }
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
249 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
250 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
251 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
252 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
253 }
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
254 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
255 }
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
256
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
257 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
258 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
259 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
260 _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
261 }
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
262
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
263 // 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
264 // versions before 10.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
265 #ifndef SI_ARCHITECTURE_32
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
266 #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
267 #endif
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 #ifndef SI_ARCHITECTURE_64
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
270 #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
271 #endif
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
272
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
273 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
274 char tmp;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
275 size_t bufsize = sysinfo(si, &tmp, 1);
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
276
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
277 // All SI defines used below must be supported.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
278 guarantee(bufsize != -1, "must be supported");
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 char* buf = (char*) malloc(bufsize);
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
281
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
282 if (buf == NULL)
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
283 return;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
284
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
285 if (sysinfo(si, buf, bufsize) == bufsize) {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
286 // Compare the string.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
287 if (strcmp(buf, string) == 0) {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
288 *features |= mask;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
289 }
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
290 }
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
291
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
292 free(buf);
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
293 }
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
294
0
a61af66fc99e Initial load
duke
parents:
diff changeset
295 int VM_Version::platform_features(int features) {
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
296 // 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
297 // supported on Solaris 10 and later.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
298 if (os::Solaris::supports_getisax()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
299
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
300 // Check 32-bit architecture.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
301 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
302
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
303 // Check 64-bit architecture.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
304 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
305
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
306 // Extract valid instruction set extensions.
14312
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
307 uint_t avs[2];
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
308 uint_t avn = os::Solaris::getisax(avs, 2);
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
309 assert(avn <= 2, "should return two or less av's");
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
310 uint_t av = avs[0];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
311
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
312 #ifndef PRODUCT
14312
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
313 if (PrintMiscellaneous && Verbose) {
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
314 tty->print("getisax(2) returned: " PTR32_FORMAT, av);
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
315 if (avn > 1) {
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
316 tty->print(", " PTR32_FORMAT, avs[1]);
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
317 }
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
318 tty->cr();
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
319 }
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
320 #endif
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
321
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
322 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
323 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
324 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
325 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
326 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
327 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
328 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m;
14312
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
329 if (avn > 1) {
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
330 uint_t av2 = avs[1];
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
331 #ifndef AV2_SPARC_SPARC5
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
332 #define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
333 #endif
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
334 if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
73b1030c6253 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 14261
diff changeset
335 }
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
336
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
337 // 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
338 // 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
339 #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
340 #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
341 #endif
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
342 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
343
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
344 #ifndef AV_SPARC_FMAF
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
345 #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
346 #endif
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
347 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m;
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
348
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
349 #ifndef AV_SPARC_FMAU
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
350 #define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
351 #endif
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
352 if (av & AV_SPARC_FMAU) features |= fmau_instructions_m;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
353
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
354 #ifndef AV_SPARC_VIS3
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
355 #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
356 #endif
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
357 if (av & AV_SPARC_VIS3) features |= vis3_instructions_m;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
358
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2247
diff changeset
359 #ifndef AV_SPARC_CBCOND
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2247
diff changeset
360 #define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2247
diff changeset
361 #endif
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2247
diff changeset
362 if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2247
diff changeset
363
14261
00f5eff62d18 8002074: Support for AES on SPARC
kvn
parents: 6842
diff changeset
364 #ifndef AV_SPARC_AES
00f5eff62d18 8002074: Support for AES on SPARC
kvn
parents: 6842
diff changeset
365 #define AV_SPARC_AES 0x00020000 /* aes instrs supported */
00f5eff62d18 8002074: Support for AES on SPARC
kvn
parents: 6842
diff changeset
366 #endif
00f5eff62d18 8002074: Support for AES on SPARC
kvn
parents: 6842
diff changeset
367 if (av & AV_SPARC_AES) features |= aes_instructions_m;
00f5eff62d18 8002074: Support for AES on SPARC
kvn
parents: 6842
diff changeset
368
20313
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
369 #ifndef AV_SPARC_SHA1
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
370 #define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
371 #endif
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
372 if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
373
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
374 #ifndef AV_SPARC_SHA256
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
375 #define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
376 #endif
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
377 if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
378
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
379 #ifndef AV_SPARC_SHA512
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
380 #define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
381 #endif
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
382 if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
b20a35eae442 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 14312
diff changeset
383
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
384 } else {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
385 // getisax(2) failed, use the old legacy code.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
386 #ifndef PRODUCT
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
387 if (PrintMiscellaneous && Verbose)
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1552
diff changeset
388 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
389 #endif
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
390
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
391 char tmp;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
392 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1);
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
393 char* buf = (char*) malloc(bufsize);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
394
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
395 if (buf != NULL) {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
396 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
397 // Figure out what kind of sparc we have
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
398 char *sparc_string = strstr(buf, "sparc");
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
399 if (sparc_string != NULL) { features |= v8_instructions_m;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
400 if (sparc_string[5] == 'v') {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
401 if (sparc_string[6] == '8') {
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
402 if (sparc_string[7] == '-') { features |= hardware_mul32_m;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
403 features |= hardware_div32_m;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
404 } 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
405 else features |= generic_v8_m;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
406 } 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
407 }
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
408 }
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
409
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
410 // Check for visualization instructions
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
411 char *vis = strstr(buf, "vis");
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
412 if (vis != NULL) { features |= vis1_instructions_m;
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
413 if (vis[3] == '2') features |= vis2_instructions_m;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
414 }
a61af66fc99e Initial load
duke
parents:
diff changeset
415 }
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
416 free(buf);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
417 }
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419
641
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
420 // Determine the machine type.
6af0a709d52b 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 0
diff changeset
421 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
422
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
423 {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
424 // Using kstat to determine the machine type.
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
425 kstat_ctl_t* kc = kstat_open();
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
426 kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
427 const char* implementation = "UNKNOWN";
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
428 if (ksp != NULL) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
429 if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
430 kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
431 for (int i = 0; i < ksp->ks_ndata; i++) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
432 if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
433 #ifndef KSTAT_DATA_STRING
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
434 #define KSTAT_DATA_STRING 9
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
435 #endif
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
436 if (knm[i].data_type == KSTAT_DATA_CHAR) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
437 // VM is running on Solaris 8 which does not have value.str.
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
438 implementation = &(knm[i].value.c[0]);
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
439 } else if (knm[i].data_type == KSTAT_DATA_STRING) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
440 // VM is running on Solaris 10.
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
441 #ifndef KSTAT_NAMED_STR_PTR
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
442 // Solaris 8 was used to build VM, define the structure it misses.
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
443 struct str_t {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
444 union {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
445 char *ptr; /* NULL-term string */
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
446 char __pad[8]; /* 64-bit padding */
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
447 } addr;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
448 uint32_t len; /* # bytes for strlen + '\0' */
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
449 };
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
450 #define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr)
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
451 #endif
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
452 implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
453 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
454 #ifndef PRODUCT
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
455 if (PrintMiscellaneous && Verbose) {
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
456 tty->print_cr("cpu_info.implementation: %s", implementation);
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
457 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
458 #endif
2247
c52cba2a3359 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 2080
diff changeset
459 // 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
460 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
461
c52cba2a3359 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 2080
diff changeset
462 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
463 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
464 if (strstr(impl, "SPARC64") != NULL) {
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
465 features |= sparc64_family_m;
6269
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
466 } else if (strstr(impl, "SPARC-M") != NULL) {
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
467 // M-series SPARC is based on T-series.
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
468 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
469 } else if (strstr(impl, "SPARC-T") != NULL) {
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
470 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
471 if (strstr(impl, "SPARC-T1") != NULL) {
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
472 features |= T1_model_m;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
473 }
2247
c52cba2a3359 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 2080
diff changeset
474 } else {
6269
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
475 if (strstr(impl, "SPARC") == NULL) {
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
476 #ifndef PRODUCT
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
477 // kstat on Solaris 8 virtual machines (branded zones)
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
478 // returns "(unsupported)" implementation.
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
479 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl);
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
480 #endif
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
481 implementation = "SPARC";
8cb110fd7627 7188227: VM should recognize M-series SPARC
kvn
parents: 3839
diff changeset
482 }
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
483 }
2247
c52cba2a3359 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 2080
diff changeset
484 free((void*)impl);
2080
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
485 break;
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
486 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
487 } // for(
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
488 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
489 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
490 assert(strcmp(implementation, "UNKNOWN") != 0,
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
491 "unknown cpu info (changed kstat interface?)");
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
492 kstat_close(kc);
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
493 }
c04052fd6ae1 7006505: Use kstat info to identify SPARC processor
kvn
parents: 1972
diff changeset
494
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
495 // Figure out cache line sizes using PICL
23165
a0622494f6b2 8080012: JVM times out with vdbench on SPARC M7-16
poonam
parents: 22963
diff changeset
496 PICL picl((features & sparc64_family_m) != 0, (features & sun4v_m) != 0);
22963
f79d8e8caecb 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 22962
diff changeset
497 _L2_data_cache_line_size = picl.L2_data_cache_line_size();
20421
d635fd1ac81c 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 20313
diff changeset
498
0
a61af66fc99e Initial load
duke
parents:
diff changeset
499 return features;
a61af66fc99e Initial load
duke
parents:
diff changeset
500 }